tcltest::test 15.9.3-anonymous-1 { If the anonymous class extends an inner
        class, the parameters may need to include the enclosing instance for
        the superclass } {
    empty_class T1593a1 {
	class A {}
	Object o = new A() {}; // needs enclosing instance
    }
} PASS

tcltest::test 15.9.3-anonymous-2 { If the anonymous class extends an inner
        class, the parameters may need to include the enclosing instance for
        the superclass } {
    empty_class T1593a2 {
	static class A {}
	Object o = new A() {}; // does not need enclosing instance
    }
} PASS

tcltest::test 15.9.3-anonymous-3 { If the anonymous class extends an inner
        class, the parameters may need to include the enclosing instance for
        the superclass } {
    empty_class T1593a3 {
	static {
	    class A {}
	    Object o = new A() {}; // does not need enclosing instance
	}
    }
} PASS

# tests for ambiguous anonymous class constructors are in 15.9.5
tcltest::test 15.9.3-choosing-1 { A unique most-specific accessible constructor
        must exist } {
    empty_class T1593c1 {
	Object o = new Object(1); // Object(int) does not exist
    }
} FAIL

tcltest::test 15.9.3-choosing-2 { A unique most-specific accessible constructor
        must exist } {
    compile [saveas T1593c2a.java {
class T1593c2a {
    private T1593c2a() {}
}
class T1593c2b {
    Object o = new T1593c2a(); // not accessible
}
    }]
} FAIL

tcltest::test 15.9.3-choosing-3 { A unique most-specific accessible constructor
        must exist } {
    empty_class T1593c3 {
        T1593c3(int i, byte b) {}
        T1593c3(byte b, int i) {}
        byte b;
        Object o = new T1593c3(b, b);
    }
} FAIL

tcltest::test 15.9.3-choosing-4 { A unique most-specific accessible constructor
        must exist } {
    compile [saveas T1593c4a.java {
class T1593c4a {
    private T1593c4a(int i, byte b) {}
    T1593c4a(byte b, int i) {}
}
class T1593c4b {
    byte b;
    Object o = new T1593c4a(b, b) {};
}
    }]
} PASS

tcltest::test 15.9.3-choosing-5 { A unique most-specific accessible constructor
        must exist } {
    empty_class T1593c5 {
        private T1593c5() {}
        Object o = new T1593c5();
    }
} PASS

tcltest::test 15.9.3-choosing-6 { A unique most-specific accessible constructor
        must exist } {
    compile [saveas p1/T1593c6a.java {
package p1;
public class T1593c6a {
    protected T1593c6a(String s) {}
    public T1593c6a(Integer i) {}
}
    }] [saveas T1593c6b.java {
class T1593c6b {
    Object o = new p1.T1593c6a(null); // only T1593c6a(Integer) is accessible
}
    }]
} PASS

tcltest::test 15.9.3-choosing-7 { A unique most-specific accessible constructor
        must exist } {
    empty_class T1593c7 {
	A a = new A();
	static class A {
	    private A() {}
	    // compiler creates A(T1593c7$1 dummy) { this(); }
	    A(String s) {}
	}
	// no ambiguity between real A(String), synthetic A(dummy)
	{ new A(null); }
    }
} PASS

tcltest::test 15.9.3-choosing-8 { A unique most-specific accessible constructor
        must exist } {
    compile [saveas T1593c8a.java {
class T1593c8a {
    A a = new A();
    static class A {
	private A() {}
	// compiler creates A(T1593c8a$1 dummy) { this(); }
	A(String s) {}
    }
}
    }]
    delete T1593c8a.java
    compile -classpath . [saveas T1593c8b.java {
class T1593c8b {
    // no ambiguity between real A(String), synthetic A(dummy)
    { new T1593c8a.A(null); }
}
    }]
} PASS
