Not inferring from a first filter in case of two consecutive filters
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.1k
- Forks
- 370
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 68
Description
Found this false positive in the code while using.
class Aclass {
class Name {
@Nullable String firstName;
@Nullable String lastName;
@Nullable String middleName;
}
@Contract("null -> true")
public boolean isBlank(@Nullable String string) {
return string == null || string.trim().length() == 0;
}
private Observable<Integer> filterThenMap(Observable<Name> observable) {
return observable
.filter(name -> !isBlank(name.firstName) && name.middleName!=null)
.filter(name -> name.lastName!=null)
.map(name -> name.firstName.length());
}
}
This gives warning: [NullAway] dereferenced expression name.firstName is @Nullable at
.map(name -> name.firstName.length());
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 by reproducing the warning with the consecutive-filter example in the issue. Trace how NullAway carries nullness facts from one filter predicate into the next, and consider the issue done when the final map expression is accepted without a false-positive warning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100