RFR: JDK-8210649: AssertionError @ jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:244)

Jan Lahoda jan.lahoda at oracle.com
Mon May 25 14:35:00 UTC 2020


Hi,

When tools call Diagnostics.getMessage after the compilation has already 
been stopped, the invocation may fail with an error, due to javac being 
in a wrong state. When javac is running annotation processors, after 
running the processors last time, it will clear all the internal 
structures. If an error has been reported and the compilation will stop, 
it will not re-initialize the structures again (it would re-initialize 
the structure if no error would be reported, and the compilation would 
continue).

In general javac does not support doing queries after compilation 
finished. But, regarding handling Diagnostics in such cases, we've 
adjusted the code to allow queries to Diagnostics in the past.

The proposal in this patch is to not clear the internal state if we know 
the compilation will not continue, keeping the last state. So printing 
the Diagnostics would still work.

Webrev: http://cr.openjdk.java.net/~jlahoda/8210649/webrev.00/
JBS: https://bugs.openjdk.java.net/browse/JDK-8210649

How does this look?

Thanks,
     Jan


More information about the compiler-dev mailing list