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

Trees.getScope may crash when invoked for statement inside switch.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 14
    • 14
    • tools
    • None
    • b22

    Description

      Consider the attached testcase - it fails with:
      ---
      warning: No SupportedSourceVersion annotation found on GetScopeCrashes, returning RELEASE_6.
      warning: Supported source version 'RELEASE_6' from annotation processor 'GetScopeCrashes' less than -source '14'
      2 warnings
      An exception has occurred in the compiler (14-internal). 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.
      com.sun.tools.javac.util.ClientCodeException: java.lang.NullPointerException
      at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:868)
      at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:132)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1423)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1380)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:972)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:318)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
      Caused by: java.lang.NullPointerException
      at jdk.compiler/com.sun.tools.javac.code.Scope$ScopeImpl.enter(Scope.java:434)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.addVars(Attr.java:1549)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.handleSwitch(Attr.java:1536)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSwitch(Attr.java:1403)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1229)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:666)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:738)
      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:1309)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1030)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:666)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:738)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStatToTree(Attr.java:425)
      at jdk.compiler/com.sun.tools.javac.api.JavacTrees.attribStatToTree(JavacTrees.java:957)
      at jdk.compiler/com.sun.tools.javac.api.JavacTrees.getAttrContext(JavacTrees.java:929)
      at jdk.compiler/com.sun.tools.javac.api.JavacTrees.getScope(JavacTrees.java:803)
      at jdk.compiler/com.sun.tools.javac.api.JavacTrees.getScope(JavacTrees.java:166)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1753)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:459)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1531)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitCase(TreeScanner.java:372)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCase.accept(JCTree.java:1297)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitSwitch(TreeScanner.java:333)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1239)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:249)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1042)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:207)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:908)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:91)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:106)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:114)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:188)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:818)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:56)
      at GetScopeCrashes$1.finished(GetScopeCrashes.java:42)
      at jdk.compiler/com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:864)
      ... 8 more
      printing javac parameters to: /home/jlahoda/src/jdk/jdk/build/linux-x86_64-server-release/nb-jtreg/work/tools/GetScopeCrashes/javac.20190911_110013.args
      result: Error. compiler crashed (exit code 4)


      test result: Error. compiler crashed (exit code 4)
      ---

      Attachments

        Issue Links

          Activity

            People

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: