AssertionError in c.s.t.jc.comp.Modules.enter(..)

Eirik Bjørsnøs eirbjo at gmail.com
Sun Dec 11 19:12:15 UTC 2016


Hi,

I'm getting the following AssertionError from javac: (Full stacktrace at
end of email)

Exception in thread "main" java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:243)


I wanted to reduce this to a minimal testcase, but after two hours when I
thought I'd finally nailed it, I did an mvn clean somewhere and now I can't
reproduce it :-)

So what we have to work with is unfortunately my anecdotal observations:
(Can't share the full mvn build..)

* This is maven-compiler-plugin compiling via plexus-compiler via
javax.tools.JavaCompiler
* The AssertionError happens when calling diagnostic.getMessage(Locale)
* Source file being compiled imports a class from a jar on the classpath
which again imports from java.xml.bind
* java.xml.bind is _not_ added with --add-modules-path
* When I add --add-modules-path=java.xml.bind to the CompilationTask's
options, the AssetionError is no longer thrown
* When I remove a jar containing a javax.annotation.proccessing.Processor
from the -classpath, the AssertionError was no longer thrown

While my immediate problem is solved using --add-modules, I'm assuming this
AssertionError is something which should/could be fixed?

I'll try a bit more to create a minimal test case, but wanted to share my
observations anyway, since compiler internal wizards might spot what's
going on just from this.

Sorry that this report is a bit messy, it was the best I could do this time.

Let me know if there's more useful info I can provide.

Cheers,
Eirik.



Full stacktrace:

Exception in thread "main" java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:243)
at
jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:841)
at
jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:821)
at
jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1469)
at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:633)
at
jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1273)
at
jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1150)
at
jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1076)
at
jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:237)
at
jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
at
jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:1003)
at jdk.compiler/com.sun.tools.javac.code.Printer.visit(Printer.java:136)
at
jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:197)
at
jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:165)
at
jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
at
jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
at
jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument(AbstractDiagnosticFormatter.java:183)
at
jdk.compiler/com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments(AbstractDiagnosticFormatter.java:165)
at
jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:111)
at
jdk.compiler/com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage(BasicDiagnosticFormatter.java:67)
at
jdk.compiler/com.sun.tools.javac.util.JCDiagnostic.getMessage(JCDiagnostic.java:775)
at
jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.getMessage(ClientCodeWrapper.java:788)
at
org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:131)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20161211/2232adcf/attachment-0001.html>


More information about the compiler-dev mailing list