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

jshell tool: NPE is thrown which is caused by completions in extends clauses of nested classes:

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • 9
    • 9-repo-kulla
    • tools
    • generic
    • generic

      NPE is thrown which is caused by completions in extends clauses of nested classes:

      -> class C {class D extends [TAB]

      Exception in thread "main" java.lang.NullPointerException
              at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:890)
              at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:836)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:591)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:660)
              at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4356)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4263)
              at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4192)
              at com.sun.tools.javac.comp.Attr.visitClassDef(Attr.java:883)
              at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:744)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:591)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:660)
              at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:679)
              at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1135)
              at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:984)
              at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:591)
              at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:660)
              at com.sun.tools.javac.comp.Attr.attribStatToTree(Attr.java:409)
              at com.sun.tools.javac.api.JavacTrees.attribStatToTree(JavacTrees.java:836)
              at com.sun.tools.javac.api.JavacTrees.getAttrContext(JavacTrees.java:810)
              at com.sun.tools.javac.api.JavacTrees.getScope(JavacTrees.java:705)
              at com.sun.tools.javac.api.JavacTrees.getScope(JavacTrees.java:122)
              at jdk.jshell.SourceCodeAnalysisImpl.createAccessibilityFilter(SourceCodeAnalysisImpl.java:470)
              at jdk.jshell.SourceCodeAnalysisImpl.computeSuggestions(SourceCodeAnalysisImpl.java:243)
              at jdk.jshell.SourceCodeAnalysisImpl.completionSuggestions(SourceCodeAnalysisImpl.java:229)
              at jdk.internal.jshell.tool.ConsoleIOContext$2.complete(ConsoleIOContext.java:92)
              at jdk.internal.jline.console.ConsoleReader.complete(ConsoleReader.java:3290)
              at jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2650)
              at jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2277)
              at jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:153)
              at jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:447)
              at jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:266)
              at jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:245)
              at jdk.internal.jshell.tool.JShellTool.main(JShellTool.java:235)

      These also could be the cause of the NPE:
      -> class C {class D implements [TAB]
      -> class C {interface I extends [TAB]

      These aren't the cause of the NPE:
      -> interface I {class C extends [TAB]
      -> interface I {class C implements [TAB
      -> interface I {interface I extends [TAB]

            rfield Robert Field (Inactive)
            shinyafox Shinya Yoshida
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: