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

JShell: NPE in SourceCodeAnalysis.completionSuggestions()

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 10
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b31
    • CPU:
      generic
    • OS:
      generic

      Description

      jshell> for (int:<TAB>

      Exception in thread "main" java.lang.NullPointerException
      at jdk.compiler/com.sun.tools.javac.tree.TreeInfo.getStartPos(TreeInfo.java:458)
      at jdk.compiler/com.sun.tools.javac.api.JavacTrees$1.getStartPosition(JavacTrees.java:239)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:553)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:547)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitEnhancedForLoop(TreeScanner.java:304)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCEnhancedForLoop.accept(JCTree.java:1166)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:561)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:547)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:248)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:561)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:547)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:206)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:898)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:561)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:547)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:90)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:187)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:808)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:561)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:547)
      at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:105)
      at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:113)
      at jdk.compiler/com.sun.source.util.TreeScanner.visitCompilationUnit(TreeScanner.java:144)
      at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:591)
      at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:82)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl$2.scan(SourceCodeAnalysisImpl.java:561)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl.pathFor(SourceCodeAnalysisImpl.java:570)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl.computeSuggestions(SourceCodeAnalysisImpl.java:293)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl.completionSuggestionsImpl(SourceCodeAnalysisImpl.java:282)
      at jdk.jshell/jdk.jshell.SourceCodeAnalysisImpl.completionSuggestions(SourceCodeAnalysisImpl.java:247)
      at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.complete(ConsoleIOContext.java:218)
      at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.access$000(ConsoleIOContext.java:69)
      at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext$1.complete(ConsoleIOContext.java:100)
      at jdk.internal.le/jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2684)
      at jdk.internal.le/jdk.internal.jline.console.ConsoleReader.readLine(ConsoleReader.java:2279)
      at jdk.jshell/jdk.internal.jshell.tool.ConsoleIOContext.readLine(ConsoleIOContext.java:139)
      at jdk.jshell/jdk.internal.jshell.tool.JShellTool.run(JShellTool.java:1140)
      at jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:929)
      at jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.run(JShellToolBuilder.java:239)
      at jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:119)

      Thank you, Aurelio García-Ribeyro, for reporting.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rfield Robert Field
                Reporter:
                rfield Robert Field
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: