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

   ### Apache NetBeans version
   
   Apache NetBeans 24
   
   ### What happened
   
   simplified snippet from NB codebase:
   
   ```java
       private void checkProgress(ExecutionEventObject eeo) {
           if (ExecutionEvent.Type.ProjectDiscoveryStarted.equals(eeo.type)) {
           } else if (ExecutionEvent.Type.SessionStarted.equals(eeo.type)) {
           } else if (ExecutionEvent.Type.ProjectStarted.equals(eeo.type)) {
           }
       }
   ```
   run hint -> convert to switch statement
   
   results:
   ```code
   java.lang.NullPointerException: Cannot invoke 
"org.netbeans.spi.java.hints.HintContext.getInfo()" because "this.ctx" is null
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.visitPrimitiveWrapperMethods(NPECheck.java:1076)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.visitMethodInvocation(NPECheck.java:1042)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.visitMethodInvocation(NPECheck.java:575)
        at 
com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1877)
        at com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
        at 
org.netbeans.api.java.source.support.CancellableTreeScanner.scan(CancellableTreeScanner.java:69)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.scan(NPECheck.java:677)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.visitBinary(NPECheck.java:898)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.visitBinary(NPECheck.java:575)
        at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:2231)
        at com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
        at 
org.netbeans.api.java.source.support.CancellableTreeScanner.scan(CancellableTreeScanner.java:69)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.scan(NPECheck.java:677)
        at 
org.netbeans.modules.java.hints.bugs.NPECheck$VisitorImpl.visitNewClass(NPECheck.java:1008)
   ```
   
   null seems to be a legal value for `ctx` - judging from the null checks in 
other places of the class.
   
   ### Language / Project Type / NetBeans Component
   
   _No response_
   
   ### How to reproduce
   
   see above
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   linux
   
   ### JDK
   
   23
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request?
   
   No


-- 
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