Reputation: 23592
I'm getting an NPE from the ECJ (version 4.2.1) compiler when running in JRE 1.7 the same project compiles properly on JRE 1.6.
A CompilationProgress
monitor shows that there are Total of 2493 tasks, but then I get the NPE.
Any ideas?
TIA
java.lang.NullPointerException
at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.concatFiles(EclipseFileManager.java:202)
at org.eclipse.jdt.internal.compiler.apt.util.EclipseFileManager.handleOption(EclipseFileManager.java:669)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl.(BatchProcessingEnvImpl.java:88)
at org.eclipse.jdt.internal.compiler.apt.dispatch.BatchAnnotationProcessorManager.configure(BatchAnnotationProcessorManager.java:69)
at org.eclipse.jdt.internal.compiler.batch.Main.initializeAnnotationProcessorManager(Main.java:3632)
at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:3737)
at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1679)
at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1372)
at org.eclipse.jdt.core.compiler.batch.BatchCompiler.compile(BatchCompiler.java:80)
at org.eclipse.jdt.core.compiler.batch.BatchCompiler.compile(BatchCompiler.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
...
at java.lang.Thread.run(Thread.java:722)
Upvotes: 0
Views: 1238
Reputation: 23592
Turns out to be an Eclipse JDT bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=405225
Hopefully it will be fixed in the next version.
Upvotes: 0
Reputation: 141
I'm randomly guessing that you've run into a Windows problem I ran into with ECJ at one point, where the command line gets too long for Windows to handle.
What fixed it for me was putting the classpath alone in a text file and passing that to ECJ, but you should be able to add all your options to a text file and pass that instead, which would be safer long-term (see "Advanced options" @ http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-using_batch_compiler.htm), something akin to:
ecj-options.txt
-g -1.6 -extdirs "F:/Workspace/git/igal-getrailo/railo-java/libs;C:\Apps\railo-builder\webapps\railo-builder\WEB-INF\railo\lib\compile" -sourcepath F:/Workspace/git/igal-getrailo/railo-java/railo-loader/src[-d none] -d F:/Workspace/railo-build/railo-4.0.5.001-patch-d/__railo-core-bin
Then adding @ecj-options.txt to the args, something like:
java -jar ecj.jar @ecj-options.txt F:/Workspace/railo-build/railo-4.0.5.001-patch-d/__railo-core-src
Upvotes: 1
Reputation: 28757
Looks like the exception is being caused inside of the command line args processing. Specifically on the -extdirs
option. The locations
object is null and the only way that this can be is if the close()
method has already been called on the EclipseFileManager
. I can't see why exactly, but I would recommend that you grab the source code and fire this up in the debugger.
I know that this is not really an answer, but hopefully, this can at least get you a bit closer to solving the problem.
Upvotes: 1