Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of obsolete declaration annotations on arrays where the element is a type parameter #6374

Open
cushon opened this issue Dec 17, 2023 · 0 comments
Assignees

Comments

@cushon
Copy link
Contributor

cushon commented Dec 17, 2023

Is the behaviour below expected? Per https://checkerframework.org/manual/#declaration-annotations-moved, I thought the declaration annotation below would be treated as if I had written T @Nonnull... with an equivalent type annotation.

// lib/Lib.java
import javax.annotation.Nonnull;

public class Lib {
  static <T> void x(@Nonnull T... o) {}
}
// User.java
public class User {
  void go() {
    Lib.x("", null);
  }
}
$ ./checker-framework-3.42.0/checker/bin/javac -cp jsr305-3.0.2.jar lib/Lib.java -d out
$ ./checker-framework-3.42.0/checker/bin/javac -cp out -processor nullness User.java
User.java:3: error: [argument] incompatible argument for parameter arg0 of Lib.x.
    Lib.x("", null);
              ^
  found   : null (NullType)
  required: @Initialized @NonNull String
1 error
@smillst smillst self-assigned this Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants