NPECheck (the “Null Pointer Dereference” hint) should support `@Target(TYPE_USE)` annotations
Apache NetBeans version
Apache NetBeans 13
What happened
Using a @NonNull or @Nullable annotation that has @Target(TYPE_USE) causes the “Null Pointer Dereference” hint to not work.
How to reproduce
Use a @NotNull or @Nullable annotation that has @Target(TYPE_USE), such as the ones provided by JSpecify.
Did this work correctly in an earlier version?
No
Operating System
Windows 10
JDK
OpenJDK Runtime Environment Temurin-18.0.1+10 (build 18.0.1+10)
Apache NetBeans packaging
Apache NetBeans provided installer
Anything else
Nullity annotations that make use of Java 8’s ElementType.TYPE_USE are becoming more and more common as time goes on[^1].
[^1]: They’re already in use in Guava
Are you willing to submit a pull request?
No
Code of Conduct
Yes
@ExE-Boss can you post a minimal example which uses the annotation and causes the hint to not work?
@mbien
Any existing case where a non‑TYPE_USE @CheckForNull, @NonNull, or @Nullable annotation is replaced with a TYPE_USE one.
Simply add @java.lang.annotation.Target(java.lang.annotation.ElementType.TYPE_USE) to all the @interface test cases in NPECheckTest.java and they behave as if no nullity annotation was present.
Now that JSpecify 1.0 has been released, this is probably more important than ever.