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

NPE: Cannot invoke "com.sun.tools.javac.code.Symbol.isEnum()" because "expr.sym" is null

    XMLWordPrintable

    Details

    • Introduced In Version:
      17
    • CPU:
      generic
    • OS:
      generic

      Description

      ADDITIONAL SYSTEM INFORMATION :
      java version "17.0.1" 2021-10-19 LTS
      Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
      Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      Since our code base has ~600 kLOC and the crash happens during the compilation of our main module (~1800 source files), it's hard to pin-point the offending source file (please advise how to do this if you need further information to track down the cause of this issue).

      The following command-line arguments were passed:

      -d /home/target/classes -classpath ..... -sourcepath ..... -s ..... -g -nowarn --release 17 -encoding UTF-8 --enable-preview

      ------------------------------
      An exception has occurred in the compiler (17.0.1). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.NullPointerException: Cannot invoke "com.sun.tools.javac.code.Symbol.isEnum()" because "expr.sym" is null
              at jdk.compiler/com.sun.tools.javac.comp.Flow$AliveAnalyzer.handleConstantCaseLabel(Flow.java:740)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$AliveAnalyzer.visitSwitchExpression(Flow.java:715)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitchExpression.accept(JCTree.java:1380)
              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:444)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$AliveAnalyzer.visitYield(Flow.java:874)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCYield.accept(JCTree.java:1658)
              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:444)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitCase(TreeScanner.java:181)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCase.accept(JCTree.java:1335)
              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:444)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$AliveAnalyzer.analyzeTree(Flow.java:945)
              at jdk.compiler/com.sun.tools.javac.comp.Flow.aliveAfter(Flow.java:273)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.handleSwitch(Attr.java:1800)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSwitchExpression(Attr.java:1610)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitchExpression.accept(JCTree.java:1380)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:500)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:480)
              at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:467)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.lambda$processArg$0(ArgumentAttr.java:220)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:242)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.processArg(ArgumentAttr.java:219)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitSwitchExpression(ArgumentAttr.java:260)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitchExpression.accept(JCTree.java:1380)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:672)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:775)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2554)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1797)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:2421)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1709)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:748)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:767)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1445)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1091)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:748)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIf(Attr.java:2194)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1553)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:748)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:767)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1445)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1091)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:748)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1235)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:921)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:674)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:748)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5474)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5365)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5196)
              at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5141)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1317)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
              at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
              at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
              at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
              at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1134)
              at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:187)
              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:972)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.base/java.lang.reflect.Method.invoke(Method.java:568)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
              at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
              at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
              at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)


      REGRESSION : Last worked in version 16

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile source code

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compiler does not crash.
      ACTUAL -
      Compiler crashes with NPE.

      ---------- BEGIN SOURCE ----------
      Since our code base has ~600 kLOC and the crash happens during the compilation of our main module (~1800 source files), it's hard to pin-point the offending source file (please advise how to do this if you need further information to track down the cause of this issue).
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jlahoda Jan Lahoda
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: