| 1 |
// Test case for issue #577: |
| 2 |
// Test with expected errors: checker/tests/nullness/Issue577.java |
| 3 |
// https://github.com/typetools/checker-framework/issues/577 |
| 4 |
class Banana<T extends Number> extends Apple<int[]> { |
| 5 |
@Override |
| 6 |
void fooIssue577Outer(int[] array) {} |
| 7 |
|
| 8 |
class InnerBanana extends InnerApple<long[]> { |
| 9 |
@Override |
| 10 |
<F2> void foo(int[] array, long[] array2, F2 param3) {} |
| 11 |
} |
| 12 |
} |
| 13 |
|
| 14 |
class Apple<T> { |
| 15 |
void fooIssue577Outer(T param) {} |
| 16 |
|
| 17 |
class InnerApple<E> { |
| 18 |
<F> void foo(T param, E param2, F param3) {} |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
class Pineapple<E> extends Apple<E> { |
| 23 |
@Override |
| 24 |
void fooIssue577Outer(E array) {} |
| 25 |
} |
| 26 |
|
| 27 |
class IntersectionAsMemberOf { |
| 28 |
interface MyGenericInterface<F> { |
| 29 |
F getF(); |
| 30 |
} |
| 31 |
|
| 32 |
<T extends Object & MyGenericInterface<String>> void foo(T param) { |
| 33 |
String s = param.getF(); |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
class UnionAsMemberOf { |
| 38 |
interface MyInterface<T> { |
| 39 |
T getT(); |
| 40 |
} |
| 41 |
|
| 42 |
class MyExceptionA extends Throwable implements Cloneable, MyInterface<String> { |
| 43 |
public String getT() { |
| 44 |
return "t"; |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
class MyExceptionB extends Throwable implements Cloneable, MyInterface<String> { |
| 49 |
public String getT() { |
| 50 |
return "t"; |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
void bar() throws MyExceptionA, MyExceptionB {} |
| 55 |
|
| 56 |
void foo1(MyInterface<Throwable> param) throws Throwable { |
| 57 |
try { |
| 58 |
bar(); |
| 59 |
} catch (MyExceptionA | MyExceptionB ex1) { |
| 60 |
String s = ex1.getT(); |
| 61 |
} |
| 62 |
} |
| 63 |
} |
| 64 |
|
| 65 |
final class Issue577Outer<K extends Object> { |
| 66 |
private Inner createInner(ReferenceQueue<? super K> q) { |
| 67 |
return new Inner(q); |
| 68 |
} |
| 69 |
|
| 70 |
private final class Inner { |
| 71 |
private Inner(ReferenceQueue<? super K> q) {} |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
class ReferenceQueue<T> {} |