Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-415

NullPointerException from javac when compiling AntlrWorks-Jank

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Invalid
    • 3.1
    • None
    • None
    • macOS 10.14.6, iMac Pro, AdoptOpenJDK 9, OpenJDK 11.0.2, AdoptOpenJDK 13.0.2

    Description

      I'm working on a project called AntlrWorks-Jank, an attempt to revive the defunct ANTLRWorks application. https://github.com/apjanke/antlrworks2-jank

      When compiling the latest work-in-progress version of my code, I'm getting a NullPointerException apparently raised inside the javac code when it's called by the Maven Compiler Plugin.

      [antlrworks-jank] $ mvn -e compile
      [INFO] Error stacktraces are turned on.
      [...]
      [INFO] works-editor-antlr4 ................................ FAILURE [  1.026 s]
      [INFO] antlr-works-editor ................................. SKIPPED
      [INFO] tvl-editor-whitespace .............................. SKIPPED
      [INFO] works-editor-antlr3 ................................ SKIPPED
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  2.028 s
      [INFO] Finished at: 2020-05-08T03:01:54-04:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project works-editor-antlr4: Fatal error compiling: CompilerException: NullPointerException -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project works-editor-antlr4: Fatal error compiling
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
      [...]
      Caused by: java.lang.NullPointerException
          at com.sun.tools.javac.main.JavaCompiler.readSourceFile (JavaCompiler.java:825)
          at com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete (JavacProcessingEnvironment.java:1510)
          at com.sun.tools.javac.code.Symbol.complete (Symbol.java:633)
          at com.sun.tools.javac.code.Symbol$ClassSymbol.complete (Symbol.java:1314)
          at com.sun.tools.javac.code.Type$ClassType.complete (Type.java:1139)
          at com.sun.tools.javac.code.Type$ClassType.getTypeArguments (Type.java:1065)
          at com.sun.tools.javac.code.Printer.visitClassType (Printer.java:237)
          at com.sun.tools.javac.code.Printer.visitClassType (Printer.java:52)
          at com.sun.tools.javac.code.Type$ClassType.accept (Type.java:992)
          at com.sun.tools.javac.code.Printer.visit (Printer.java:136)
          at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument (AbstractDiagnosticFormatter.java:197)
          at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments (AbstractDiagnosticFormatter.java:165)
          at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage (BasicDiagnosticFormatter.java:111)
          at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage (BasicDiagnosticFormatter.java:67)
          at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArgument (AbstractDiagnosticFormatter.java:183)
          at com.sun.tools.javac.util.AbstractDiagnosticFormatter.formatArguments (AbstractDiagnosticFormatter.java:165)
          at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage (BasicDiagnosticFormatter.java:111)
          at com.sun.tools.javac.util.BasicDiagnosticFormatter.formatMessage (BasicDiagnosticFormatter.java:67)
          at com.sun.tools.javac.util.JCDiagnostic.getMessage (JCDiagnostic.java:771)
          at com.sun.tools.javac.api.ClientCodeWrapper$DiagnosticSourceUnwrapper.getMessage (ClientCodeWrapper.java:799)
          at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:149)
          at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:169)
          at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:785)
          at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:129)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
      

      The full code to reproduce is on the NPE-during-compile tag in that repo: https://github.com/apjanke/antlrworks2-jank/tree/NPE-during-compile.

      I think I'm running the latest 3.8.1 version of maven-compiler-plugin, since I'm not specifying a version for it in my POMs. Seems to happen with Java 9, 11, and 13 (which I'm selecting by setting the $JAVA_HOME environment variable before running `mvn -e compile`).

      Would this be a bug in maven-compiler-plugin? Or actually a bug in javac? Or something else?

      Find output of `mvn -e compile &>antlrworks-jank-mvn-compile-NPE.log` and `mvn -X -e compile &>antlrworks-jank-mvn-compile-NPE-debug.log` attached.

      Attachments

        1. antlrworks-jank-mvn-compile-NPE-debug.log
          230 kB
          Andrew Janke
        2. antlrworks-jank-mvn-compile-NPE-02-debug.log
          202 kB
          Andrew Janke
        3. antlrworks-jank-mvn-compile-NPE-02.log
          17 kB
          Andrew Janke
        4. antlrworks-jank-mvn-compile-NPE.log
          17 kB
          Andrew Janke

        Issue Links

          Activity

            People

              rfscholte Robert Scholte
              apjanke Andrew Janke
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: