apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.59k stars 833 forks source link

NPECheck (the “Null Pointer Dereference” hint) should support `@Target(TYPE_USE)` annotations #4125

Open ExE-Boss opened 2 years ago

ExE-Boss commented 2 years ago

Apache NetBeans version

Apache NetBeans 13

What happened

Using a @NonNull or @Nullable annotation that has code>\@[Target][java.lang.annotation.Target]\([TYPE_USE][java.lang.annotation.ElementType#TYPE_USE]\)</code 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

mbien commented 7 months ago

@ExE-Boss can you post a minimal example which uses the annotation and causes the hint to not work?