Skip to content

Java Compiler Crash

Ryan Heaton edited this page Sep 17, 2015 · 1 revision

Under certain conditions that we haven't been able to isolate nor to predict, the Java compiler crashes. Unfortunately, when a crash occurs, it often happens without any diagnostics or error messages from the tool.

Bummer.

Current Status

There is currently a specific case being tracked at #117. Since this particular case was consistently reproducible, we were able to attach a debugger to the process and get some limited diagnostic messages. These messages implied some kind of unspecific "duplicate class" errors. A bug was submitted to the team at Oracle with instructions on how to reproduce the problem. We can only hope that the issue gets some attention and they fix not only the "duplicate class" error, but also the failure to produce decent diagnostic information.

Unfortunately, that still leaves a mess we have to deal with.

Dealing with the Mess

Since we don't yet know what causes the problem, the only thing we can currently do is tweak the javac parameters until the compiler doesn't crash anymore. Following are the parameters that are provided to the compiler and how they can be adjusted.

Source Path

The most likely way to get around the compiler crash might be to limit or disable the source path. While this hasn't been proven yet, the errors seem to be most often triggered by some condition of the source path.

Ant users can tweak the source path by adjusting the path element in the build file. Maven users can tweak the source path by using the sourcepathIncludes and sourcepathExcludes configuration elements of the plugin in the pom. For details, see the section about the source path at Multi Module Projects. Maven users can also use the disableSourcepath configuration element (or -D enunciate.disable.sourcepath command-line option) to completely disable the source path.

A side effect of adjusting the source path is that some documentation elements might not be available because the Java source code (which contains all the Javadoc) isn't provided.

Class Path

The error might be caused by some element on the classpath. Ant users can tweak the classpath by adjusting the path element in the build file. Maven users can tweak the classpath by adjusting the project dependencies.

A side effect of adjuting the classpath is that the compile might fail due to missing classes or other resources.

Source Files

Maybe the error is caused by something in your source files? Seems unlikely, but you can give it a try. Ant users can adjust the fileset in the build file. Maven users can adjust the project source files using the includes and excludes elements in the configuration of the plugin in the pom.

How to Help

The current status of this issue is being tracked at #146, where it was originally reported. If you figure out a way around it, please comment on the issue and report your solution so that we can all see what's most often working.

If you really want to go the extra mile, see if you can figure out the root cause of the crash in the hope that we can find a way to predict it and avoid it. Please contribute your findings by commenting at #146 or by sending Ryan an e-mail message.

Clone this wiki locally