mbien commented on code in PR #9450:
URL: https://github.com/apache/netbeans/pull/9450#discussion_r3455757668
##########
java/java.hints/test/unit/src/org/netbeans/modules/java/hints/bugs/NPECheckTest.java:
##########
@@ -1970,6 +2001,26 @@ enum E {A}
.assertWarnings("9:12-9:21:verifier:ERR_NotNull");
}
+ public void testIfAndInstanceOf() throws Exception {
+ HintTest.create()
+ .sourceLevel("21")
+ .input("""
+ package test;
+ public class Test {
+ public @NotNull Object test(Object o) {
+ if (o instanceof String s) {
+ return s;
+ } else {
+ return o; //can't say anything
Review Comment:
I see (I think). The parameter `Object o` isn't marked as nullable so the
checker is instructed to not complain on `return o;` ?
but in past it could "upgrade" `o` to nullable since it thinks the
`instanceof` was used as null check? (that would be the connection to
NETBEANS-407?)
--
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