< prev index next >

test/langtools/tools/javac/SuperInit/SuperInitGood.java

Print this page
*** 22,10 ***
--- 22,13 ---
   */
  /*
   * @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 {

*** 42,10 ***
--- 45,11 ---
  
      // No explicit calls to this()/super()
      static class Test1 {
          Test1() {
          }
+ 
          Test1(int a) {
              this.hashCode();
          }
      }
  

*** 419,15 ***
          }
          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 {
--- 423,10 ---

*** 510,10 ***
--- 509,24 ---
                  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>();

*** 557,7 ***
--- 570,8 ---
          new Test21((int)123);
          new Test21((float)123);
          new Test22('x');
          new Test23();
          new Test24();
+         new Test25(null);
      }
  }
< prev index next >