test/hotspot/jtreg/runtime/Nestmates/privateConstructors/TestConstructorHierarchy.java
changeset 50816 a73848f8d0ad
parent 50766 759f63d8a9fe
child 54432 532e88de77eb
equal deleted inserted replaced
50815:54a285a5c6cb 50816:a73848f8d0ad
    49         try {
    49         try {
    50             new ExternalSuper();
    50             new ExternalSuper();
    51             throw new Error("Unexpected construction of ExternalSuper");
    51             throw new Error("Unexpected construction of ExternalSuper");
    52         }
    52         }
    53         catch (IllegalAccessError iae) {
    53         catch (IllegalAccessError iae) {
    54             if (iae.getMessage().contains("class TestConstructorHierarchy tried to access method ExternalSuper.<init>()V")) {
    54             if (iae.getMessage().contains("class TestConstructorHierarchy tried to access private method ExternalSuper.<init>()V")) {
    55                 System.out.println("Got expected exception constructing ExternalSuper: " + iae);
    55                 System.out.println("Got expected exception constructing ExternalSuper: " + iae);
    56             }
    56             }
    57             else throw new Error("Unexpected IllegalAccessError: " + iae);
    57             else throw new Error("Unexpected IllegalAccessError: " + iae);
    58         }
    58         }
    59         try {
    59         try {
    60             new NestedA();
    60             new NestedA();
    61             throw new Error("Unexpected construction of NestedA and supers");
    61             throw new Error("Unexpected construction of NestedA and supers");
    62         }
    62         }
    63         catch (IllegalAccessError iae) {
    63         catch (IllegalAccessError iae) {
    64             if (iae.getMessage().contains("class TestConstructorHierarchy$NestedA tried to access method ExternalSuper.<init>()V")) {
    64             if (iae.getMessage().contains("class TestConstructorHierarchy$NestedA tried to access private method ExternalSuper.<init>()V")) {
    65                 System.out.println("Got expected exception constructing NestedA: " + iae);
    65                 System.out.println("Got expected exception constructing NestedA: " + iae);
    66             }
    66             }
    67             else throw new Error("Unexpected IllegalAccessError: " + iae);
    67             else throw new Error("Unexpected IllegalAccessError: " + iae);
    68         }
    68         }
    69         try {
    69         try {
    70             new ExternalSub();
    70             new ExternalSub();
    71             throw new Error("Unexpected construction of ExternalSub");
    71             throw new Error("Unexpected construction of ExternalSub");
    72         }
    72         }
    73         catch (IllegalAccessError iae) {
    73         catch (IllegalAccessError iae) {
    74             if (iae.getMessage().contains("class ExternalSub tried to access method TestConstructorHierarchy$NestedA.<init>()V")) {
    74             if (iae.getMessage().contains("class ExternalSub tried to access private method TestConstructorHierarchy$NestedA.<init>()V")) {
    75                 System.out.println("Got expected exception constructing ExternalSub: " + iae);
    75                 System.out.println("Got expected exception constructing ExternalSub: " + iae);
    76             }
    76             }
    77             else throw new Error("Unexpected IllegalAccessError: " + iae);
    77             else throw new Error("Unexpected IllegalAccessError: " + iae);
    78         }
    78         }
    79     }
    79     }