Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8222161

Compiler fails with NullPointerException

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 12
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "12" 2019-03-19
      OpenJDK Runtime Environment (build 12+33)
      OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing)
      Maven 3.6.0, maven-compiler-plugin 3.8.0


      A DESCRIPTION OF THE PROBLEM :
      Looks similar to JDK-8206917 and JDK-8206102, but seems to be at a different location and in JDK 12:
      java.lang.NullPointerException
              at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1304)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:394)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$LambdaFlowAnalyzer.visitLambda(Flow.java:1499)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1886)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:394)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1396)
              at jdk.compiler/com.sun.tools.javac.comp.Flow.analyzeLambdaThrownTypes(Flow.java:251)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2805)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1886)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$4.complete(DeferredAttr.java:377)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr$ArgumentType.complete(ArgumentAttr.java:371)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:338)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:324)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1058)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:885)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:773)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:894)
              at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:181)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:603)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:642)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4321)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:4114)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:4015)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:4004)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3897)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2189)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2191)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitConditional(Attr.java:1691)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCConditional.accept(JCTree.java:1452)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:2051)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1621)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1307)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1307)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:501)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:484)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:459)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:903)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:881)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1886)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:835)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:338)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:782)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:629)
              at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:214)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:603)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1561)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1731)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1800)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1774)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$10.doLookup(Resolve.java:2652)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3291)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3541)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2649)
              at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2643)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3922)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3802)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2189)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2191)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:2051)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1621)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:756)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1307)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1111)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:872)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:664)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:737)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4884)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4775)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4704)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4649)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1341)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:75)
              at jdk.internal.reflect.GeneratedMethodAccessor38.invoke(Unknown Source)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:567)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess0(JavacCompiler.java:626)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcessWithProperClassloader(JavacCompiler.java:607)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:596)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:178)
              at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1129)
              at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:188)
              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)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
              at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
              at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
              at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
              at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
              at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:567)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
              at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
              at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I don't know exactly what causes this issue. Compiling my project with maven this issue arises. Due to JDK-8216202 (or a similar issue) I am compiling with the maven-compiler-plugin setting <forceJavacCompilerUse>true</forceJavacCompilerUse> which fixed compiling with JDK 11.0.2 for me. But for JDK 12 even this setting doesn't help. JDK-8216202 mentioned JAXB as a source for problems. We are using JAXB 2.3.1, so maybe this is still an issue.


      CUSTOMER SUBMITTED WORKAROUND :
      Use JDK 11.

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fmatte Fairoz Matte
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: