openrewrite / openrewrite/rewrite-static-analysis
org.openrewrite.staticanalysis.AvoidBoxedBooleanExpressions does not understand @NonNull annotations
Open
Nobody has claimed this yet.
bug
- Dominant language
- Java
- Stars
- 62
- Forks
- 112
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 40
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the org.openrewrite.staticanalysis.AvoidBoxedBooleanExpressions recipe entry point and reproduce the behavior using the Java snippet in the issue. Check how the recipe handles the @NonNull Boolean parameter, then add coverage for the annotation case and confirm the recipe preserves the expected code instead of rewriting it to Boolean.TRUE.equals(b).
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100