uber / uber/NullAway

Null propagation doesn't work between Java Stream operations

Open
#697 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.1k
Forks
370
Avg merge
1d 13h
Merged PRs (30d)
68

Description

A common pattern in some codebases is to filter streams by the keys of a map:

  private Stream<String> filterBasedOnMapKeys(Map<String, String> map, Stream<String> stream) {
    return stream
            .filter(map::containsKey)
            .map(value -> someMethod(map.get(value)));
  }

This fails the null check, claiming that the method someMethod is being passed a nullable value when not null is required. However, as the stream has already been filtered, the .get(...) call is safe.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Java stream reproducer in the issue and locate the NullAway analysis entry points and tests covering stream operations and map lookups. Determine how nullness is propagated across the filter and map chain; done means this pattern no longer reports a nullable argument while unsafe lookups remain diagnosed.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.