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

   ### Apache NetBeans version
   
   Apache NetBeans 18
   
   ### What happened
   
   Using `Objects.requireNonNull` should disable "Null Pointer Dereference" 
warnings. Instead, it doesn't.
   
   ### How to reproduce
   
   ```java
   public static String myToString(Object object) {
       Objects.requireNonNull(object);
       if (object instanceof Number) {
           DecimalFormat df = new DecimalFormat("#.00");
           return df.format(((Number) object).doubleValue());
       } else {
           return object.toString();
       }
   }
   ```
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Windows 10 version 10.0 running on amd64; Cp1252; it_IT (nb)
   
   ### JDK
   
   11.0.14.1; OpenJDK 64-Bit Server VM 11.0.14.1+1
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   ![null 
warning](https://github.com/apache/netbeans/assets/18428155/6470fe7e-e4e9-4306-96de-3b02be74788b)
   
   if `Objects.requireNonNull(object);` is replaced by `if (object == null) 
throw new NullPointerException();` the warning disappears.
   
   ### 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