< prev index next > test/langtools/tools/javac/SuperInit/SuperInitGood.java
Print this page
*/
/*
* @test
* @bug 8194743 8345438 8356551 8349754
* @summary Test valid placements of super()/this() in constructors
+ * @run main SuperInitGood
+ * @build InitializationWarningTester
+ * @run main InitializationWarningTester SuperInitGood SuperInitGoodWarnings.out
*/
import java.util.concurrent.atomic.AtomicReference;
public class SuperInitGood {
// No explicit calls to this()/super()
static class Test1 {
Test1() {
}
+
Test1(int a) {
this.hashCode();
}
}
}
public Test20(char x) {
Test20.this.x = x;
super();
}
- public Test20(byte y) {
- x = y;
- this((int)y);
- this.x++;
- }
}
// allow creating and using local and anonymous classes before super()
// they will not have enclosing instances though
public static class Test21 {
super();
}
}
}
+ public static class Test25 {
+ public Test25(Object o) {}
+
+ class Sub extends Test25 {
+ public Sub() {
+ super(new Object() {
+ void foo() {
+ getClass();
+ }
+ });
+ }
+ }
+ }
+
public static void main(String[] args) {
new Test0();
new Test1();
new Test1(7);
new Test2<Byte>();
new Test21((int)123);
new Test21((float)123);
new Test22('x');
new Test23();
new Test24();
+ new Test25(null);
}
}
< prev index next >