typetools / typetools/checker-framework
Handling of obsolete declaration annotations on arrays where the element is a type parameter
Open
@smillst is already working on this.
Since Jan 17, 2024.
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
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
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.
Assessment
This issue has not been assessed yet.