private T Compile <T>(string className, string source, CompilationListener <T> listener) { JavaCompiler systemCompiler = ToolProvider.SystemJavaCompiler; JavaFileManager manager = new InMemFileManager(); DiagnosticCollector <JavaFileObject> diagnosticsCollector = new DiagnosticCollector <JavaFileObject>(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: Iterable<? extends javax.tools.JavaFileObject> sources = java.util.Collections.singletonList(new InMemSource(className, source)); IEnumerable <JavaFileObject> sources = Collections.singletonList(new InMemSource(className, source)); JavaCompiler.CompilationTask task = systemCompiler.getTask(null, manager, diagnosticsCollector, null, null, sources); bool?success = task.call(); return(listener.Compiled(success, manager, diagnosticsCollector.Diagnostics)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public Iterable<? extends org.neo4j.codegen.ByteCodes> compile(java.util.List<JavaSourceFile> sourceFiles, ClassLoader loader) throws org.neo4j.codegen.CompilationFailureException //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: public override IEnumerable <ByteCodes> Compile(IList <JavaSourceFile> sourceFiles, ClassLoader loader) { DiagnosticCollector <JavaFileObject> diagnostics = new DiagnosticCollector <JavaFileObject>(); FileManager fileManager = new FileManager(_compiler.getStandardFileManager(diagnostics, _configuration.locale(), _configuration.charset())); JavaCompiler.CompilationTask task = _compiler.getTask(_configuration.errorWriter(), fileManager, diagnostics, _configuration.options(), null, sourceFiles); _configuration.processors(task); if (task.call()) { _configuration.warningsHandler().handle(diagnostics.Diagnostics); return(fileManager.Bytecodes()); } else { //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") java.util.List<javax.tools.Diagnostic<?>> issues = (java.util.List) diagnostics.getDiagnostics(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: IList <Diagnostic <object> > issues = (System.Collections.IList)diagnostics.Diagnostics; throw new CompilationFailureException(issues); } }
public virtual void Processors(JavaCompiler.CompilationTask task) { task.Processors = _processors; }