typetools / typetools/checker-framework
Incorrect annotations on enclosing type type parameters
Open
Nobody has claimed this yet.
False Positive (false warning or imprecision)
- Dominant language
- Java
- Stars
- 1.1k
- Forks
- 440
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 134
Description
@SuppressWarnings("initialization.fields.uninitialized")
public abstract class EnclosingType<T extends @Nullable Number> {
abstract class Inner{
abstract T get();
abstract void set(T t);
}
Inner i;
T t;
void setI(Inner i) {
i.set(this.i.get()); // error here
}
}
I expected no error, but the following was issued:
error: [argument.type.incompatible] incompatible argument for parameter t of set.
i.set(this.i.get());
^
found : T[ extends @Initialized @Nullable Number super @Initialized @NonNull Void]
required: T[ extends @Initialized @NonNull Number super @Initialized @NonNull Void]
The explicit annotation on the bound of T is ignored.
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.
Research direction
Start with the Java reproducer in the issue and trace how the Checker Framework processes the @Nullable bound on EnclosingType. Identify the type-annotation handling responsible for the mismatch, then verify that i.set(this.i.get()) is accepted without changing unrelated diagnostics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100