tcltest::test 15.11.2-syntax-1 { The type in the qualified super is not
        obscured } {
    compile [saveas T15112s1a.java {
class T15112s1a {
    int i;
}
class T15112s1b extends T15112s1a {
    int T15112s1b; // obscure the class name from normal expressions
    int j = T15112s1b.super.i;
}
    }]
} PASS

tcltest::test 15.11.2-syntax-2 { The type in qualified super may not be a
        primitive type } {
    compile [saveas T15112s2a.java {
class T15112s2a {
    int i;
}
class T15112s2b extends T15112s2a {
    Object o = int.super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-3 { The type in qualified super may not be an
        array type } {
    compile [saveas T15112s3a.java {
class T15112s3a {
    int i;
}
class T15112s3b extends T15112s3a {
    Object o = int[].super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-4 { The type in qualified super may not be an
        array type } {
    compile [saveas T15112s4a.java {
class T15112s4a {
    int i;
}
class T15112s4b extends T15112s4a {
    Object o = T15112s4a[].super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-5 { The type in qualified super may not be
        null } {
    compile [saveas T15112s5a.java {
class T15112s5a {
    int i;
}
class T15112s5b extends T15112s5a {
    Object o = null.super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-6 { The type in qualified super may not be
        void } {
    compile [saveas T15112s6a.java {
class T15112s6a {
    int i;
}
class T15112s6b extends T15112s6a {
    Object o = void.super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-7 { The type in qualified super may not be a
        literal } {
    compile [saveas T15112s7a.java {
class T15112s7a {
    int i;
}
class T15112s7b extends T15112s7a {
    Object o = 1 .super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-8 { The type in qualified super may not be a
        literal } {
    compile [saveas T15112s8a.java {
class T15112s8a {
    int i;
}
class T15112s8b extends T15112s8a {
    Object o = "1".super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-syntax-9 { The type in qualified super must enclose the
        current type } {
    empty_class T15112s9 {
	static class A {
	    static int i;
	}
	class B extends A {}
	int j = B.super.i;
    }
} FAIL

tcltest::test 15.11.2-syntax-10 { The type in qualified super must enclose the
        current type } {
    empty_class T15112s10 {
	interface A {
	    int i = 1;
	}
	interface B extends A {
	    class C {
		int j = B.super.i; // B encloses C, but is not a class
	    }
	}
    }
} FAIL

tcltest::test 15.11.2-explicit-constructor-1 { Cannot access instance fields
        from this class within an explicit constructor } {
    empty_class T15112ec1 {
	int i;
	T15112ec1(int i) {}
	class Sub extends T15112ec1 {
	    Sub() {
		// calling superclass version of inherited i is wrong
		super(super.i);
	    }
	}
    }
} FAIL

tcltest::test 15.11.2-explicit-constructor-2 { Cannot access instance fields
        from this class within an explicit constructor } {
    empty_class T15112ec2 {
	class One {
	    int i;
	}
	class Two extends One {
	    class Inner {
		Inner(int i) {}
		Inner() {
		    // calling super field of enclosing class is legal
		    this(Two.super.i);
		}
	    }
	}
    }
} PASS

tcltest::test 15.11.2-use-1 { super.field must be in non-static context } {
    empty_class T15112u1 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static int j = super.i;
	}
    }
} FAIL

tcltest::test 15.11.2-use-2 { super.field must be in non-static context } {
    empty_class T15112u2 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static { super.i++; }
	}
    }
} FAIL

tcltest::test 15.11.2-use-3 { super.field must be in non-static context } {
    empty_class T15112u3 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static void m() { super.i++; }
	}
    }
} FAIL

tcltest::test 15.11.2-use-4 { super.field must be in non-static context } {
    empty_class T15112u4 {
	interface A {
	    int i = 1;
	}
	interface B extends A {
	    int j = super.i;
	}
    }
} FAIL

tcltest::test 15.11.2-use-5 { super.field must be in non-static context } {
    empty_class T15112u5 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static int j = B.super.i;
	}
    }
} FAIL

tcltest::test 15.11.2-use-6 { super.field must be in non-static context } {
    empty_class T15112u6 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static { B.super.i++; }
	}
    }
} FAIL

tcltest::test 15.11.2-use-7 { super.field must be in non-static context } {
    empty_class T15112u7 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static void m() { B.super.i++; }
	}
    }
} FAIL

tcltest::test 15.11.2-use-8 { super.field must be in non-static context } {
    empty_class T15112u8 {
	interface A {
	    int i = 1;
	}
	interface B extends A {
	    int j = B.super.i;
	}
    }
} FAIL

tcltest::test 15.11.2-use-9 { super.field must refer to a single accessible
        field in the superclass } {
    compile [saveas T15112u9a.java {
class T15112u9a {
    private int i;
}
class T15112u9b extends T15112u9a {
    int j = super.i;
}
    }]
} FAIL

tcltest::test 15.11.2-use-10 { super.field must refer to a single accessible
        field in the superclass } {
    empty_class T15112u10 {
	int i = super.no_such_field;
    }
} FAIL

tcltest::test 15.11.2-use-11 { super.field must refer to a single accessible
        field in the superclass } {
    empty_class T15112u11 {
	class A {
	    int i;
	}
	interface B {
	    Object i = null;
	}
	class C extends A implements B {
	    int j = super.i; // refers to A.i, not B.i
	}
    }
} PASS

tcltest::test 15.11.2-use-12 { super.field must refer to a single accessible
        field in the superclass } {
    empty_class T15112u12 {
	class A {
	    int i;
	}
	interface B {
	    Object i = null;
	}
	class C extends A implements B {}
	class D extends C {
	    int j = super.i; // ambiguous between A.i and B.i
	}
    }
} FAIL

tcltest::test 15.11.2-meaning-1 { super.field is (almost) ((S)this).field } {
    empty_class T15112m1 {
	class A {
	    int i;
	}
	class B extends A {
	    Object i;
	    int j = super.i;
	    int k = ((A) this).i;
	}
    }
} PASS

tcltest::test 15.11.2-meaning-2 { super.field is (almost) ((S)this).field } {
    compile [saveas p1/T15112m2a.java {
package p1;
public class T15112m2a {
    protected int i;
}
    }] [saveas T15112m2b.java {
class T15112m2b extends p1.T15112m2a {
    Object i;
    int j = super.i;
}
    }]
} PASS

tcltest::test 15.11.2-meaning-3 { super.field is (almost) ((S)this).field } {
    compile [saveas p1/T15112m3a.java {
package p1;
public class T15112m3a {
    protected int i;
}
    }] [saveas T15112m3b.java {
class T15112m3b extends p1.T15112m3a {
    Object i;
    // oops, wrong qualifier for instance field access
    int j = ((p1.T15112m3a) this).i;
}
    }]
} FAIL

tcltest::test 15.11.2-meaning-4 { super.field is (almost) ((S)this).field } {
    compile [saveas p1/T15112m4a.java {
package p1;
public class T15112m4a {
    protected static int i;
}
    }] [saveas T15112m4b.java {
class T15112m4b extends p1.T15112m4a {
    Object i;
    int j = super.i;
    int k = ((p1.T15112m4a) this).i;
}
    }]
} PASS

tcltest::test 15.11.2-meaning-5 { super.field is (almost) ((S)this).field } {
    compile [saveas p1/T15112m5c.java {
package p1;
class T15112m5a {
    protected int i;
}
interface T15112m5b {
    int i = 1;
}
public class T15112m5c extends T15112m5a implements T15112m5b {}
    }] [saveas T15112m5d.java {
class T15112m5d extends p1.T15112m5c {
    int j = super.i; // ambiguous between a.i and b.i
}
    }]
} FAIL

tcltest::test 15.11.2-meaning-6 { super.field is (almost) ((S)this).field } {
    compile [saveas p1/T15112m6c.java {
package p1;
class T15112m6a {
    protected int i;
}
interface T15112m6b {
    int i = 1;
}
public class T15112m6c extends T15112m6a implements T15112m6b {}
    }] [saveas T15112m6d.java {
class T15112m6d extends p1.T15112m6c {
    int j = ((p1.T15112m6c) this).i; // a.i not accessible, so this is b.i
}
    }]
} PASS

tcltest::test 15.11.2-meaning-7 { super.field is (almost) ((S)this).field } {
    empty_class T15112m7 {
	class A {
	    private int i;
	}
	class B extends A {
	    Object i;
	    int j = super.i;
	    int k = ((A) this).i;
	}
    }
} PASS

tcltest::test 15.11.2-meaning-8 { T.super.field is (almost)
        ((S)T.this).field } {
    empty_class T15112m8 {
	class A {
	    int i;
	}
	class B extends A {
	    Object i;
	    int j = B.super.i;
	    int k = ((A) B.this).i;
	}
    }
} PASS

tcltest::test 15.11.2-meaning-9 { T.super.field is (almost)
        ((S)T.this).field } {
    compile [saveas p1/T15112m9a.java {
package p1;
public class T15112m9a {
    protected int i;
}
    }] [saveas T15112m9b.java {
class T15112m9b extends p1.T15112m9a {
    Object i;
    int j = T15112m9b.super.i;
}
    }]
} PASS

tcltest::test 15.11.2-meaning-10 { T.super.field is (almost)
        ((S)T.this).field } {
    compile [saveas p1/T15112m10a.java {
package p1;
public class T15112m10a {
    protected int i;
}
    }] [saveas T15112m10b.java {
class T15112m10b extends p1.T15112m10a {
    Object i;
    // oops, wrong qualifier for instance field access
    int j = ((p1.T15112m10a) T15112m10b.this).i;
}
    }]
} FAIL

tcltest::test 15.11.2-meaning-11 { T.super.field is (almost)
        ((S)T.this).field } {
    compile [saveas p1/T15112m11a.java {
package p1;
public class T15112m11a {
    protected static int i;
}
    }] [saveas T15112m11b.java {
class T15112m11b extends p1.T15112m11a {
    Object i;
    int j = T15112m11b.super.i;
    int k = ((p1.T15112m11a) T15112m11b.this).i;
}
    }]
} PASS

tcltest::test 15.11.2-meaning-12 { T.super.field is (almost)
        ((S)T.this).field } {
    compile [saveas p1/T15112m12c.java {
package p1;
class T15112m12a {
    protected int i;
}
interface T15112m12b {
    int i = 1;
}
public class T15112m12c extends T15112m12a implements T15112m12b {}
    }] [saveas T15112m12d.java {
class T15112m12d extends p1.T15112m12c {
    int j = T15112m12d.super.i; // ambiguous between a.i and b.i
}
    }]
} FAIL

tcltest::test 15.11.2-meaning-13 { T.super.field is (almost)
        ((S)T.this).field } {
    compile [saveas p1/T15112m13c.java {
package p1;
class T15112m13a {
    protected int i;
}
interface T15112m13b {
    int i = 1;
}
public class T15112m13c extends T15112m13a implements T15112m13b {}
    }] [saveas T15112m13d.java {
class T15112m13d extends p1.T15112m13c {
    // a.i not accessible, so this is b.i
    int j = ((p1.T15112m13c) T15112m13d.this).i;
}
    }]
} PASS

tcltest::test 15.11.2-meaning-14 { T.super.field is (almost)
        ((S)T.this).field } {
    empty_class T15112m14 {
	class A {
	    private int i;
	}
	class B extends A {
	    Object i;
	    int j = B.super.i;
	    int k = ((A) B.this).i;
	}
    }
} PASS

tcltest::test 15.11.2-meaning-15 { T.super.field is (almost)
        ((S)T.this).field } {
    empty_class T15112m15 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static class Inner {
		int i = B.super.i;
	    }
	}
    }
} FAIL

tcltest::test 15.11.2-meaning-16 { T.super.field is (almost)
        ((S)T.this).field } {
    empty_class T15112m16 {
	static class A {
	    static int i;
	}
	static class B extends A {
	    static class Inner {
		int i = ((A) B.this).i;
	    }
	}
    }
} FAIL

tcltest::test 15.11.2-meaning-17 { T.super.field is (almost)
        ((S)T.this).field } {
    empty_class T15112m17 {
	class A {
	    int i;
	}
	class S {
	    Object i;
	}
	class B extends A {
	    Object i;
	    class Inner extends S {
		Object i;
		int j = B.super.i;
		int k = ((A) B.this).i;
	    }
	}
    }
} PASS
