1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*
* @test
* @summary Test case for issue #2853: https://github.com/typetools/checker-framework/issues/2853
*
* @compile/timeout=30 -XDrawDiagnostics -Xlint:unchecked -processor org.checkerframework.checker.nullness.NullnessChecker Issue2853.java
*/
public class Issue2853 {
abstract static class A {
abstract B getB();
public abstract C getC();
public abstract Object getD();
public abstract Object getE();
public abstract Object getF();
public abstract Object getG();
public abstract H getH();
}
abstract static class B {}
abstract static class C {
abstract Object getI();
}
static class I {
static class J {}
}
abstract static class H {
abstract Object getK();
abstract Object getL();
abstract Object getM();
abstract Object getN();
}
abstract static class O {}
abstract static class J {
static O f(B b) {
throw new AssertionError();
}
}
abstract static class K {
abstract Object getL();
}
abstract static class M {
abstract N getN();
}
abstract static class N {
abstract Object f();
}
static class Test {
static final ImmutableSet<P> C =
new ImmutableSet.Builder<P>()
.add(R.c((A x) -> J.f(x.getB())))
.add(R.c((A x) -> x.getC().getI()))
.add(R.c((M x) -> x.getN().f()))
.add(R.c((A x) -> x.getH().getK()))
.add(R.c((A x) -> x.getH().getM()))
.add(R.c((A x) -> x.getH().getL()))
.add(R.c((A x) -> x.getH().getN()))
.add(R.c((A x) -> x.getD()))
.add(R.c((A x) -> x.getE()))
.add(R.c((A x) -> x.getE()))
.add(R.c((A x) -> x.getG()))
.add(R.c((K x) -> x.getL()))
.build();
interface P {}
interface Q<U, V> {
V get(U message);
}
private static class R<T, U> implements P {
static <T, U> R<T, U> c(Q<T, U> x) {
throw new AssertionError();
}
}
}
abstract static class ImmutableSet<E> {
static class Builder<E> {
public Builder<E> add(E... elements) {
throw new AssertionError();
}
public ImmutableSet<E> build() {
throw new AssertionError();
}
}
}
}
|