Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1033527 // invokeEcj_direct (adds ECJ as library to current program)

JavaX fragment (include) [tags: use-pretranspiled]

Uses 3106K of libraries. Click here for Pure Java version (4641L/26K).

lib 1400533 // ECJ

sS invokeEcj_direct(File optionsFile) ctex {
  new StringWriter writer;
  PrintWriter printWriter = new(writer);
  
  S[] args = { "@" + optionsFile.getPath() };
      
  org.eclipse.jdt.internal.compiler.batch.Main
    ecj = new org.eclipse.jdt.internal.compiler.batch.Main
      (printWriter, printWriter, false);
  ecj.compile(args);
  int errors = ecj.globalErrorsCount;

  S output = str(writer);
  if (errors != 0) {
    print(output);
    throw new JavaCompileException("ECJ returned errors. " + output + "\nOptions: " + loadTextFile(optionsFile));
  }
  ret output;
}

Author comment

Began life as a copy of #1008598

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033527
Snippet name: invokeEcj_direct (adds ECJ as library to current program)
Eternal ID of this version: #1033527/5
Text MD5: 119ef66d49ba9a00d445fb16ba3c8cfa
Transpilation MD5: 74bf802016da8770057a471adb4355cd
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-02 00:48:44
Source code size: 615 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 80 / 118
Version history: 4 change(s)
Referenced in: [show references]