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

   ### Apache NetBeans version
   
   Apache NetBeans 30
   
   ### What happened
   
   Editing java file, get `the assigned value is never used`. This is not 
accurate, should be no warning.
   
   ### Language / Project Type / NetBeans Component
   
   _No response_
   
   ### How to reproduce
   
   1. Edit the following `class Warn`
   
   Observe the warning on the indicated line: `data = switch(o) {`
   
   Note: it looks like the analysis is getting confused by the `throw`. Replace 
the throw, like with `"j"`, and the warning goes away.
   
   ```java
   package com.raelity.play.warn;
   
   public class Warn {
   public void f()
   {
       String data = null;
       Object o = g(null);
       if (o != null) {
           data = switch(o) { // warn: the assigned value is never used
           case Integer _ -> "i";
           default -> throw new IllegalArgumentException();
           };
       }
       g(data);
   }
   Object g(Object o) {
       return 1;
   }
   }
   ```
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Linux harmony 6.17.9-76061709-generic #202511241048~1764704751~22.04~b24b425 
SMP PREEMPT_DYNAMIC Tue D x86_64 x86_64 x86_64 GNU/Linux
   
   ### JDK
   
   openjdk version "26" 2026-03-17 OpenJDK Runtime Environment (build 
26+35-2893) OpenJDK 64-Bit Server VM (build 26+35-2893, mixed mode, sharing)
   
   ### 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