Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5003

Exception thrown while using 'pattern matching instance of' finalization in JDK16.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • java - Editor

    Description

      Write below code on java editor and save

      -------------------------------------------------

       

      public class PatternMatchingFinalizationTest {/**
      {{ * @param args the command line arguments}}
      {{ */}}
      {{ public static void main(String[] args) {}}
      {{ // TODO code application logic here }}
      {{ Object o = new String("Hello Java ");}}
      {{ if(o instanceof String s){}}
      {{ System.out.println(s);}}
      {{ }}}
      {{ }}}

      }

      -----------------------------------------------------------

      Below exception thrown on editor

      -------------------------------------

      java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.netbeans.modules.java.editor.base.semantic.TreeShims.getBinding(com.sun.source.tree.Tree)" is nulljava.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "org.netbeans.modules.java.editor.base.semantic.TreeShims.getBinding(com.sun.source.tree.Tree)" is null at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1017) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94) at jdk.compiler/com.sun.source.util.TreeScanner.visitInstanceOf(TreeScanner.java:677) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCInstanceOf.accept(JCTree.java:2178) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.source.util.TreeScanner.visitParenthesized(TreeScanner.java:595) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCParens.accept(JCTree.java:1970) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.source.util.TreeScanner.visitIf(TreeScanner.java:441) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIf.accept(JCTree.java:1513) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94) at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:78) at jdk.compiler/com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:254) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1059) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitMethod(SemanticHighlighterBase.java:836) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitMethod(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:925) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:94) at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:78) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitClass(SemanticHighlighterBase.java:944) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitClass(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:832) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.source.util.TreeScanner.scan(TreeScanner.java:109) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:78) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitCompilationUnit(SemanticHighlighterBase.java:561) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitCompilationUnit(SemanticHighlighterBase.java:280) at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:603) at jdk.compiler/com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:86) at org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1021) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase.process(SemanticHighlighterBase.java:156) at org.netbeans.modules.java.editor.semantic.SemanticHighlighter.process(SemanticHighlighter.java:56) at org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase.run(SemanticHighlighterBase.java:112) at org.netbeans.modules.parsing.impl.TaskProcessor.callParserResultTask(TaskProcessor.java:561)[catch] at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:786) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279) at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702) at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033) 

      Attachments

        Activity

          People

            Unassigned Unassigned
            singh-akhilesh Akhilesh Singh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: