Skip to content

False Positive when using JSpecify Nullable on varargs elements #1088

Closed

Description

@lukasgraef

When using Nullaway 0.12.1 in default mode in combination with JSpecify Nullable on vararg elements, like
public static void foo(@org.jspecify.annotations.Nullable String... args), I get the following error when passing a nullable parameter:
[NullAway] passing @Nullable parameter (String) null where @NonNull is required, although Nullable elements are explicitly permitted.

If the function is defined in the same class or even the same module of the caller, this works without any error.

The issue only arises when the function is defined outside the caller's module. I suspect this has to do with the differences between the source and bytecode analysis that Nullaway does.

I could reproduce this within the VarargsTests, when creating a testcase with varargs from bytecode: master...lukasgraef:NullAway:master

Activity

  1. N1k145 commented on Dec 11, 2024

    @N1k145

    I have the same issue even when using classic "javax.annotation" Nullable. And those I can't place like the JSpecify anotations.
    Even when both methods are part of the same class (but there is an interface involved, no idea it this creates the same scenario ans in @lukasgraef example)

  2. msridhar commented on Dec 11, 2024

    @msridhar
    Contributor

    I'll try to look at this soon. @N1k145 for your case an example would be helpful

  3. msridhar commented on Dec 12, 2024

    @msridhar
    Contributor

    @N1k145 for clarity I've split out your issue into #1090. Let's discuss there. #1089 should fix the original issue reported here.

  4. added a commit that references this issue on Dec 12, 2024
    cac2ed3
  5. msridhar commented on Dec 13, 2024

    @msridhar
    Contributor

    NullAway 0.12.2 is released with the fix for this issue. FYI @sdeleuze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions