rewrite-static-analysis icon indicating copy to clipboard operation
rewrite-static-analysis copied to clipboard

Recipe to remove @NonNull from primitive fields

Open blipper opened this issue 2 years ago • 1 comments

import lombok.NonNull;

class Foo {
    @NonNull
    boolean bar;
}

This should be fixed to

class Foo {
    boolean bar;
}

Support all https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html

blipper avatar Apr 17 '23 19:04 blipper

After https://github.com/openrewrite/rewrite/issues/2838 has been resolved, we could rely on "known" non-null and nullable annotations defined in KnownNullabilityAnnotations.java.

In addition, I propose we widen the scope of this recipe to "Remove nullability annotations from primitive fields" to include nullable annotations as well.

AlexanderSkrock avatar Apr 20 '23 09:04 AlexanderSkrock