diamonds: do not capture wildcard on inference (IDEA-73689 )

This commit is contained in:
anna
2011-08-31 16:53:36 +02:00
parent 2583e0bc7b
commit ab1d2768b6
2 changed files with 22 additions and 14 deletions
@@ -97,14 +97,14 @@ interface I<T> {
class FI1 {
I<? extends String> i1 = new I<<error descr="Cannot use ''<>'' with anonymous inner classes"></error>>() {
@Override
public String m() {
public <error descr="'m()' in 'Anonymous class derived from I' clashes with 'm()' in 'I'; attempting to use incompatible return type">String</error> m() {
return null;
}
};
I<?> i2 = new I<<error descr="Cannot use ''<>'' with anonymous inner classes"></error>>() {
@Override
public Object m() {
public <error descr="'m()' in 'Anonymous class derived from I' clashes with 'm()' in 'I'; attempting to use incompatible return type">Object</error> m() {
return null;
}
};
@@ -152,4 +152,23 @@ class ParenthTest<T extends TZ> {
ParenthTest<T> x = (new ParenthTest<>(null)); //red code is here
return 1;
}
}
class TestWildcardInference {
interface A<T> {
}
class B<V> implements A<V> {
B(C<V> v) {
}
}
class C<E> {}
class U {
void foo() {
C<? extends Number> x = null;
A<? extends Number> y = new B<>(x);
}
}
}