Method applicability error for generic method in wildcard parameterized type
Issue #259
resolved
ExtendJ 8.1.0-4-ge296850 Java SE 7
The following fails to compile:
// .result: COMPILE_PASS
import java.util.*;
public class Test {
void add(Container<? super X> xs) {
xs.add(new Y());
}
static class X { }
static class Y extends X { }
}
interface Container<T> {
void add(T t);
}
Expected result: should compile.
Actual result:
tests/generics/wildcard_10p/Test.java:5: error: no method named add(Test.Y) in Container<? super X> matches. However, there is a method add(wildcards.? super X)
Comments (2)
-
reporter -
reporter - changed status to resolved
Fix error in WildcardSuperType subtyping equations
The equations for the supertype attributes for WildcardSuperType were incorrect.
fixes
#259(bitbucket)→ <<cset 5bb53b0caf1b>>
- Log in to comment
This issue is caused by incorrect subtyping rules for WildcardSuperType: