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).

1  
lib 1400533 // ECJ
2  
3  
sS invokeEcj_direct(File optionsFile) ctex {
4  
  new StringWriter writer;
5  
  PrintWriter printWriter = new(writer);
6  
  
7  
  S[] args = { "@" + optionsFile.getPath() };
8  
      
9  
  org.eclipse.jdt.internal.compiler.batch.Main
10  
    ecj = new org.eclipse.jdt.internal.compiler.batch.Main
11  
      (printWriter, printWriter, false);
12  
  ecj.compile(args);
13  
  int errors = ecj.globalErrorsCount;
14  
15  
  S output = str(writer);
16  
  if (errors != 0) {
17  
    print(output);
18  
    throw new JavaCompileException("ECJ returned errors. " + output + "\nOptions: " + loadTextFile(optionsFile));
19  
  }
20  
  ret output;
21  
}

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: 195 / 225
Version history: 4 change(s)
Referenced in: [show references]