uber / uber/NullAway

Update handling of varargs in unannotated / unmarked code

Open
#1,027 0 comments 0 reactions 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

Follow-up to #1025. If the varargs argument is in unannotated code and restrictive annotations are disabled, callers from marked code should be able to pass @Nullable either for individual varargs arguments or a @Nullable varargs array.

With restrictive annotations enabled, hopefully this table should cover the behaviors when we see explicit @NonNull annotations (legacy mode behavior to be confirmed):

Annotation Type Annotation Position Mode @NonNull varargs array @NonNull individual args
declaration - standard
declaration - legacy
declaration - JSpecify
type use before ... standard
type use before ... legacy
type use before ... JSpecify
type use elements standard
type use elements legacy
type use elements JSpecify
type use both standard
type use both legacy
type use both JSpecify
both before ... standard
both before ... legacy
both before ... JSpecify
both elements standard
both elements legacy
both elements JSpecify
both both standard
both both legacy
both both JSpecify

Note that restrictive annotations are read from @NullUnmarked code by default, so calls into @NullUnmarked code should behave as per the table even if the restrictive annotations flag is not passed.

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 by reading the linked follow-up issue #1025 and compare the current varargs behavior with the table in this issue. Trace the existing nullability analysis for unannotated and @NullUnmarked calls, then add coverage for the listed annotation positions and modes; done means the observed results match the table.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.