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

20
LINES

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

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

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

1  
lib 1400533 // ECJ
2  
3  
import javax.tools.Diagnostic;
4  
import javax.tools.DiagnosticCollector;
5  
import javax.tools.JavaFileObject;
6  
import org.eclipse.jdt.internal.compiler.tool.EclipseCompilerImpl;
7  
8  
static L<Diagnostic<? extends JavaFileObject>> invokeEcj_direct_withDiagnostics(File optionsFile) ctex {
9  
  new StringWriter writer;
10  
  PrintWriter printWriter = new(writer);
11  
  
12  
  S[] args = { "@" + optionsFile.getPath() };
13  
  
14  
  EclipseCompilerImpl compiler = new EclipseCompilerImpl(printWriter, printWriter, false);
15  
  DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<>();
16  
  compiler.diagnosticListener = diagnosticCollector;
17  
  compiler.compile(args);
18  
  L<Diagnostic<? extends JavaFileObject>> diagnostics = diagnosticCollector.getDiagnostics();
19  
  ret diagnostics;
20  
}

Author comment

Began life as a copy of #1033527

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1034083
Snippet name: invokeEcj_direct_withDiagnostics (adds ECJ as library to current program)
Eternal ID of this version: #1034083/1
Text MD5: e36b50193a2c7ecd168744597eeccb7e
Transpilation MD5: b3935ca33583f4837525799501361276
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-21 15:37:47
Source code size: 811 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 142 / 209
Referenced in: [show references]