SBasalaev opened a new issue, #5090:
URL: https://github.com/apache/netbeans/issues/5090

   ### Apache NetBeans version
   
   Apache NetBeans 16
   
   ### What happened
   
   When I add a case with a block to the switch expression, exception 
notification appears and completion stops working. If I try to save a file 
after that the whole application freezes.
   
   ### How to reproduce
   
   Suppose I have a class
   ```java
   class Switch {
       public boolean test(Object value) {
           return switch (value) {
               default -> false;
           }
       }
   }
   ```
   Then I start adding a new case. The issue happens right after I type the 
opening brace
   ```java
   class Switch {
       public boolean test(Object value) {
           return switch (value) {
               case Boolean b -> {    // <- this line added
               default -> false;
           }
       }
   }
   ```
   Creating file with that contents does not always cause the issue but typing 
the line in editor always does. This also happened in previous versions of 
NetBeans and with previous JDK versions.
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Ubuntu Linux 22.04 amd64
   
   ### JDK
   
   OpenJDK 16 (system provided)
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   Stack trace reported by NetBeans
   ```
   Caused: java.lang.NullPointerException: Cannot read field "type" because 
"tree" is null
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanCond(Flow.java:2145)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitYield(Flow.java:2785)
        at com.sun.tools.javac.tree.JCTree$JCYield.accept(JCTree.java:1660)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
        at 
com.sun.tools.javac.comp.Flow$BaseAnalyzer.scanSyntheticBreak(Flow.java:459)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.handleSwitch(Flow.java:2597)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitSwitchExpression(Flow.java:2565)
        at 
com.sun.tools.javac.tree.JCTree$JCSwitchExpression.accept(JCTree.java:1382)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExpr(Flow.java:2118)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitReturn(Flow.java:2818)
        at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1711)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitBlock(Flow.java:2402)
        at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1082)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitMethodDef(Flow.java:2305)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:912)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:2243)
        at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:810)
        at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
        at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:447)
        at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scan(Flow.java:1861)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:3031)
        at 
com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:3013)
        at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:224)
        at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1377)
        at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1341)
        at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:404)
        at 
com.sun.tools.javac.api.JavacTaskImpl.lambda$analyze$1(JavacTaskImpl.java:379)
        at 
com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
        at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:379)
   Caused: java.lang.IllegalStateException
        at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)
        at 
org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:770)
        at 
org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:540)
        at 
org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:141)
        at 
org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
        at 
org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:241)
        at 
org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
        at org.openide.util.lookup.Lookups.executeWith(Lookups.java:279)
        at 
org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
   [catch] at 
org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
        at 
java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        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)
   ```
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to