You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code.java:4: error: type argument ? extends List<String> is not within bounds of type-variable T
void foo(Code<? extends List<String>> p) {}
^
where T is a type-variable:
T extends List<Number> declared in class Code
1 error
Code.java:5: error: [type.argument.type.incompatible] incompatible type argument for type parameter T of Code.
void foo(Code<? extends List<Number>> p) {}
^
found : @NonNull List<@NonNull Number>
required: @NonNull List<@Nullable Number>
1 error
This is a valuable error, but it might be costly to implement.
Allowing this parameter type should not affect soundness, as no call of the method can provide an argument that has that type.
First, evaluate whether these checks have a significant impact on compilation times.
If so, add a new option to enable these extended checks if desired.
This issue only arises for wildcards and type parameters with generic types. For non-generic types, the capture of the wildcard will always be within the expected bound, as there always is a GLB.
Take this code:
we get an error from normal javac:
However, this code is okay for javac:
But the Nullness Checker complains with:
This is a valuable error, but it might be costly to implement.
Allowing this parameter type should not affect soundness, as no call of the method can provide an argument that has that type.
First, evaluate whether these checks have a significant impact on compilation times.
If so, add a new option to enable these extended checks if desired.
This issue only arises for wildcards and type parameters with generic types. For non-generic types, the capture of the wildcard will always be within the expected bound, as there always is a GLB.
checker-framework/framework/src/main/java/org/checkerframework/common/basetype/BaseTypeValidator.java
Line 595 in e558998
checker-framework/framework/src/main/java/org/checkerframework/common/basetype/BaseTypeValidator.java
Line 631 in e558998
The text was updated successfully, but these errors were encountered: