diamonds inference: test data just-in-case

This commit is contained in:
anna
2011-02-21 15:03:31 +01:00
parent 4a73acca96
commit e29bf9f509
@@ -42,4 +42,28 @@ class Test1 {
}
class FF<X> extends F<X>{}
class F<T> {}
class F<T> {}
class MyTest {
static class Foo<X> {
Foo(X x) {}
}
static interface Base<Y> {}
static class A extends Exception implements Base<String> {}
static class B extends Exception implements Base<Integer> {}
void m() throws B {
try {
if (true) {
throw new A();
}
else {
throw new B();
}
} catch (A ex) {
Foo<? extends Base<String>> foo1 = new Foo<>(ex); // ok
<error descr="Incompatible types. Found: 'MyTest.Foo<MyTest.A>', required: 'MyTest.Foo<MyTest.Base<java.lang.String>>'">Foo<Base<String>> foo2 = new Foo<>(ex);</error> // should be error
}
}
}