rewrite-static-analysis
rewrite-static-analysis copied to clipboard
org.openrewrite.staticanalysis.AvoidBoxedBooleanExpressions does not understand @NonNull annotations
What is the smallest, simplest way to reproduce the problem?
import lombok.@NonNull
class A {
void foo(@NonNull Boolean b) {
if(b) {
}
}
What did you expect to see?
import lombok.@NonNull
class A {
void foo(@NonNull Boolean b) {
if(b) {
}
}
What did you see instead?
import lombok.@NonNull
class A {
void foo(@NonNull Boolean b) {
if(Boolean.TRUE.equals(b)) {
}
}
What is the full stack trace of any errors you encountered?
stacktrace output here
Are you interested in contributing a fix to OpenRewrite?
Thanks @blipper ; indeed seems reasonable not to make any changes to variables annotated as non-nullable. Another case where having nullability included in the type system would help:
- https://github.com/openrewrite/rewrite/issues/3221
This issue is stale because it has not had any activity for 60 days. Remove question label or comment or this will be closed in two weeks. Issues may be reopened when there is renewed interest.