< prev index next >

test/hotspot/jtreg/runtime/Nestmates/membership/TestNestmateMembership.java

Print this page

        

@@ -27,19 +27,22 @@
  * @summary Test the various rules for nest members and nest-hosts by
  * triggering nestmate access checks on all possible paths
  * @compile TestNestmateMembership.java
  *          PackagedNestHost.java
  *          PackagedNestHost2.java
+ *          InvalidNestHost.java
  *
  * @compile TargetNoHost.jcod
  *          CallerNoHost.jcod
+ *          TargetSelfHost.jcod
+ *          CallerSelfHost.jcod
  *          TargetMissingHost.jcod
  *          CallerMissingHost.jcod
- *          CallerNotInstanceHost.jcod
  *          TargetNotInstanceHost.jcod
- *          CallerNotOurHost.jcod
+ *          CallerNotInstanceHost.jcod
  *          TargetNotOurHost.jcod
+ *          CallerNotOurHost.jcod
  *          PackagedNestHost.jcod
  *          PackagedNestHost2Member.jcod
  *          PackagedNestHostMember.jcod
  *
  * @run main/othervm TestNestmateMembership method

@@ -53,11 +56,12 @@
 // except for the case where the name of the nest-member matches the name listed
 // in the nest-host, but resolves to a different class. There doesn't seem to
 // be a way to construct that scenario.
 // For each nested class below there is a corresponding .jcod file which breaks one
 // of the rules regarding nest membership. For the package related tests we have
-// additional PackageNestHost*.java sources.
+// additional PackageNestHost*.java sources.[1]
+//
 // Note that all the .java files must be compiled in the same step, while all
 // .jcod files must be compiled in a later step.
 
 // We test all the different nestmate access check paths: method invocation, constructor
 // invocations, field get and field put. The test is invoked four times with each using

@@ -66,22 +70,29 @@
 // As access checking requires resolution and validation of the nest-host of
 // both the caller class and the target class, we must check that all
 // combinations of good/bad caller/target are checked for each of the
 // possible errors:
 // - no nest-host attribute
+// - nest-host refers to self
 // - nest-host class can not be found
-// - nest-host class is not an instance class
-// - class is not a member of nest-host's nest
+// - nest-host class is not an instance class (but is in same package)
+// - class is not a member of nest-host's nest (but is in same package)
 // - class and nest-host are in different packages
 //
 // To provide coverage for reflection and MethodHandle paths through
 // JVM_AreNestmates, we add reflection/MH accesses to a subset of the tests.
 // We only need to test one case (for Caller.xxx) as all cases use the same path; further
 // we don't need to test all failure cases, as all exceptions are equivalent in that regard,
 // but for good measure we test the four basic error situations (eliding the different
 // package test for simplicity).
 //
+// [1] In earlier versions the package-test was the final check done in nest membership
+//     validation, so we needed actual test classes in different packages that claimed
+//     membership. The final spec requires the package test to be done first, so it can
+//     be trivially tested by using Object as the nest-host. But we leave the explicit
+//     package tests as they are, and adjust the other tests so that a "bad host" is
+//     always in the same package.
 
 import java.lang.invoke.*;
 import static java.lang.invoke.MethodHandles.*;
 import static java.lang.invoke.MethodType.*;
 

@@ -103,10 +114,13 @@
             Target.m();
         }
         public static void invokeTargetNoHost() {
             TargetNoHost.m();
         }
+        public static void invokeTargetSelfHost() {
+            TargetSelfHost.m();
+        }
         public static void invokeTargetMissingHost() {
             TargetMissingHost.m();
         }
         public static void invokeTargetNotInstanceHost() {
             TargetNotInstanceHost.m();

@@ -118,10 +132,13 @@
         // reflective static method invocations
 
         public static void invokeTargetNoHostReflectively() throws Throwable {
             TargetNoHost.class.getDeclaredMethod("m", new Class<?>[0]).invoke(null, new Object[0]);
         }
+        public static void invokeTargetSelfHostReflectively() throws Throwable {
+            TargetSelfHost.class.getDeclaredMethod("m", new Class<?>[0]).invoke(null, new Object[0]);
+        }
         public static void invokeTargetMissingHostReflectively() throws Throwable {
             TargetMissingHost.class.getDeclaredMethod("m", new Class<?>[0]).invoke(null, new Object[0]);
         }
         public static void invokeTargetNotInstanceHostReflectively() throws Throwable {
             TargetNotInstanceHost.class.getDeclaredMethod("m", new Class<?>[0]).invoke(null, new Object[0]);

@@ -133,10 +150,13 @@
         // MethodHandle static method lookup (no invoke as the lookup should fail)
 
         public static void invokeTargetNoHostMH() throws Throwable {
             MethodHandle mh = lookup().findStatic(TargetNoHost.class, "m", VOID_T);
         }
+        public static void invokeTargetSelfHostMH() throws Throwable {
+            MethodHandle mh = lookup().findStatic(TargetSelfHost.class, "m", VOID_T);
+        }
         public static void invokeTargetMissingHostMH() throws Throwable {
             MethodHandle mh = lookup().findStatic(TargetMissingHost.class, "m", VOID_T);
         }
         public static void invokeTargetNotInstanceHostMH() throws Throwable {
             MethodHandle mh = lookup().findStatic(TargetNotInstanceHost.class, "m", VOID_T);

@@ -152,10 +172,13 @@
             Object o = new Target();
         }
         public static void newTargetNoHost() {
             Object o = new TargetNoHost();
         }
+        public static void newTargetSelfHost() {
+            Object o = new TargetSelfHost();
+        }
         public static void newTargetMissingHost() {
             Object o = new TargetMissingHost();
         }
         public static void newTargetNotInstanceHost() {
             Object o = new TargetNotInstanceHost();

@@ -167,10 +190,13 @@
         // reflective constructor invocations
 
         public static void newTargetNoHostReflectively() throws Throwable {
             Object o = TargetNoHost.class.getDeclaredConstructor(new Class<?>[0]).newInstance(new Object[0]);
         }
+        public static void newTargetSelfHostReflectively() throws Throwable {
+            Object o = TargetSelfHost.class.getDeclaredConstructor(new Class<?>[0]).newInstance(new Object[0]);
+        }
         public static void newTargetMissingHostReflectively() throws Throwable {
             Object o = TargetMissingHost.class.getDeclaredConstructor(new Class<?>[0]).newInstance(new Object[0]);
         }
         public static void newTargetNotInstanceHostReflectively() throws Throwable {
             Object o = TargetNotInstanceHost.class.getDeclaredConstructor(new Class<?>[0]).newInstance(new Object[0]);

@@ -182,10 +208,13 @@
         // MethodHandle constructor lookup (no invoke as the lookup should fail)
 
         public static void newTargetNoHostMH() throws Throwable {
             MethodHandle mh = lookup().findConstructor(TargetNoHost.class, VOID_T);
         }
+        public static void newTargetSelfHostMH() throws Throwable {
+            MethodHandle mh = lookup().findConstructor(TargetSelfHost.class, VOID_T);
+        }
         public static void newTargetMissingHostMH() throws Throwable {
             MethodHandle mh = lookup().findConstructor(TargetMissingHost.class, VOID_T);
         }
         public static void newTargetNotInstanceHostMH() throws Throwable {
             MethodHandle mh = lookup().findConstructor(TargetNotInstanceHost.class, VOID_T);

@@ -202,10 +231,13 @@
             int x = Target.f;
         }
         public static void getFieldTargetNoHost() {
             int x = TargetNoHost.f;
         }
+        public static void getFieldTargetSelfHost() {
+            int x = TargetSelfHost.f;
+        }
         public static void getFieldTargetMissingHost() {
             int x = TargetMissingHost.f;
         }
         public static void getFieldTargetNotInstanceHost() {
             int x = TargetNotInstanceHost.f;

@@ -218,10 +250,13 @@
             Target.f = 42;
         }
         public static void putFieldTargetNoHost() {
             TargetNoHost.f = 42;
         }
+        public static void putFieldTargetSelfHost() {
+            TargetSelfHost.f = 42;
+        }
         public static void putFieldTargetMissingHost() {
             TargetMissingHost.f = 42;
         }
         public static void putFieldTargetNotInstanceHost() {
             TargetNotInstanceHost.f = 42;

@@ -233,10 +268,13 @@
         // reflective field accesses
 
         public static void getFieldTargetNoHostReflectively() throws Throwable {
             int x = TargetNoHost.class.getDeclaredField("f").getInt(null);
         }
+        public static void getFieldTargetSelfHostReflectively() throws Throwable {
+            int x = TargetSelfHost.class.getDeclaredField("f").getInt(null);
+        }
         public static void getFieldTargetMissingHostReflectively() throws Throwable {
             int x = TargetMissingHost.class.getDeclaredField("f").getInt(null);
         }
         public static void getFieldTargetNotInstanceHostReflectively() throws Throwable {
             int x = TargetNotInstanceHost.class.getDeclaredField("f").getInt(null);

@@ -246,10 +284,13 @@
         }
 
         public static void putFieldTargetNoHostReflectively() throws Throwable {
             TargetNoHost.class.getDeclaredField("f").setInt(null, 42);
         }
+        public static void putFieldTargetSelfHostReflectively() throws Throwable {
+            TargetSelfHost.class.getDeclaredField("f").setInt(null, 42);
+        }
         public static void putFieldTargetMissingHostReflectively() throws Throwable {
             TargetMissingHost.class.getDeclaredField("f").setInt(null, 42);
         }
         public static void putFieldTargetNotInstanceHostReflectively() throws Throwable {
             TargetNotInstanceHost.class.getDeclaredField("f").setInt(null, 42);

@@ -261,10 +302,13 @@
         // MethodHandle field lookup (no access as the lookup will fail)
 
         public static void getFieldTargetNoHostMH() throws Throwable {
             MethodHandle mh = lookup().findStaticGetter(TargetNoHost.class, "f", int.class);
         }
+        public static void getFieldTargetSelfHostMH() throws Throwable {
+            MethodHandle mh = lookup().findStaticGetter(TargetSelfHost.class, "f", int.class);
+        }
         public static void getFieldTargetMissingHostMH() throws Throwable {
             MethodHandle mh = lookup().findStaticGetter(TargetMissingHost.class, "f", int.class);
         }
         public static void getFieldTargetNotInstanceHostMH() throws Throwable {
             MethodHandle mh = lookup().findStaticGetter(TargetNotInstanceHost.class, "f", int.class);

@@ -274,10 +318,13 @@
         }
 
         public static void putFieldTargetNoHostMH() throws Throwable {
             MethodHandle mh = lookup().findStaticSetter(TargetNoHost.class, "f", int.class);
         }
+        public static void putFieldTargetSelfHostMH() throws Throwable {
+            MethodHandle mh = lookup().findStaticSetter(TargetSelfHost.class, "f", int.class);
+        }
         public static void putFieldTargetMissingHostMH() throws Throwable {
             MethodHandle mh = lookup().findStaticSetter(TargetMissingHost.class, "f", int.class);
         }
         public static void putFieldTargetNotInstanceHostMH() throws Throwable {
             MethodHandle mh = lookup().findStaticSetter(TargetNotInstanceHost.class, "f", int.class);

@@ -331,10 +378,55 @@
             TargetNoHost.f = 42;
         }
 
     }
 
+    static class CallerSelfHost {
+
+        // method invocations
+
+        private static void m() {
+            System.out.println("CallerSelfHost.m() - java version");
+        }
+        public static void invokeTarget() {
+            Target.m();
+        }
+        public static void invokeTargetSelfHost() {
+            TargetSelfHost.m();
+        }
+
+        // constructor invocations
+
+        private CallerSelfHost() {}
+
+        public static void newTarget() {
+            Object o = new Target();
+        }
+        public static void newTargetSelfHost() {
+            Object o = new TargetSelfHost();
+        }
+
+        // field accesses
+
+        private static int f;
+
+        public static void getFieldTarget() {
+            int x = Target.f;
+        }
+        public static void getFieldTargetSelfHost() {
+            int x = TargetSelfHost.f;
+        }
+
+        public static void putFieldTarget() {
+            Target.f = 42;
+        }
+        public static void putFieldTargetSelfHost() {
+            TargetSelfHost.f = 42;
+        }
+
+    }
+
     static class CallerMissingHost {
         String msg = "NoCallerMissingHost"; // for cp entry
 
         // method invocations
 

@@ -480,10 +572,18 @@
         private static void m() {
             System.out.println("TargetNoHost.m() - java version");
         }
     }
 
+    static class TargetSelfHost {
+        private TargetSelfHost() {}
+        private static int f;
+        private static void m() {
+            System.out.println("TargetSelfHost.m() - java version");
+        }
+    }
+
     static class TargetMissingHost {
         String msg = "NoTargetMissingHost";  // for cp entry
         private TargetMissingHost() {}
         private static int f;
         private static void m() {

@@ -515,37 +615,41 @@
         switch(args[0]) {
         case "method":
             System.out.println("TESTING METHOD INVOCATIONS:");
             test_GoodInvoke();
             test_NoHostInvoke();
+            test_SelfHostInvoke();
             test_MissingHostInvoke();
             test_NotInstanceHostInvoke();
             test_NotOurHostInvoke();
             test_WrongPackageHostInvoke();
             break;
         case "constructor":
             System.out.println("TESTING CONSTRUCTOR INVOCATIONS:");
             test_GoodConstruct();
             test_NoHostConstruct();
+            test_SelfHostConstruct();
             test_MissingHostConstruct();
             test_NotInstanceHostConstruct();
             test_NotOurHostConstruct();
             test_WrongPackageHostConstruct();
             break;
         case "getField":
             System.out.println("TESTING GETFIELD INVOCATIONS:");
             test_GoodGetField();
             test_NoHostGetField();
+            test_SelfHostGetField();
             test_MissingHostGetField();
             test_NotInstanceHostGetField();
             test_NotOurHostGetField();
             test_WrongPackageHostGetField();
             break;
         case "putField":
             System.out.println("TESTING PUTFIELD INVOCATIONS:");
             test_GoodPutField();
             test_NoHostPutField();
+            test_SelfHostPutField();
             test_MissingHostPutField();
             test_NotInstanceHostPutField();
             test_NotOurHostPutField();
             test_WrongPackageHostPutField();
             break;

@@ -612,10 +716,57 @@
         catch (IllegalAccessError expected) {
             check_expected(expected, msg);
         }
     }
 
+    static void test_SelfHostInvoke() throws Throwable {
+        System.out.println("Testing for class that lists itself as nest-host");
+        String msg = "Type TestNestmateMembership$TargetSelfHost is not a nest member" +
+            " of TestNestmateMembership$TargetSelfHost: current type is not listed as a nest member";
+        try {
+            Caller.invokeTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        try {
+            Caller.invokeTargetSelfHostReflectively();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        msg = "no such method: TestNestmateMembership$TargetSelfHost.m()void/invokeStatic";
+        try {
+            Caller.invokeTargetSelfHostMH();
+            throw new Error("Missing IllegalAccessException: " + msg);
+        }
+        catch (IllegalAccessException expected) {
+            check_expected(expected, msg);
+        }
+
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.invokeTarget();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.invokeTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+    }
+
     static void test_MissingHostInvoke() throws Throwable {
         System.out.println("Testing for nest-host class that does not exist");
         String msg = "Unable to load nest-host class (NoTargetMissingHost) of " +
             "TestNestmateMembership$TargetMissingHost";
         String cause_msg = "NoTargetMissingHost";

@@ -673,23 +824,23 @@
     }
 
     static void test_NotInstanceHostInvoke() throws Throwable {
         System.out.println("Testing for nest-host class that is not an instance class");
         String msg = "Type TestNestmateMembership$TargetNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             Caller.invokeTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.invokeTargetNotInstanceHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "no such method: TestNestmateMembership$TargetNotInstanceHost.m()void/invokeStatic";
         try {
             Caller.invokeTargetNotInstanceHostMH();

@@ -698,45 +849,45 @@
         catch (IllegalAccessException expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.invokeTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.invokeTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_NotOurHostInvoke() throws Throwable {
         System.out.println("Testing for nest-host class that does not list us in its nest");
         String msg = "Type TestNestmateMembership$TargetNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             Caller.invokeTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.invokeTargetNotOurHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "no such method: TestNestmateMembership$TargetNotOurHost.m()void/invokeStatic";
         try {
             Caller.invokeTargetNotOurHostMH();

@@ -745,45 +896,45 @@
         catch (IllegalAccessException expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.invokeTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.invokeTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_WrongPackageHostInvoke() {
         System.out.println("Testing for nest-host and nest-member in different packages");
         String msg = "Type P2.PackagedNestHost2$Member is not a nest member of " +
             "P1.PackagedNestHost: types are in different packages";
         try {
             P1.PackagedNestHost.doInvoke();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             P2.PackagedNestHost2.Member.doInvoke();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     // constructor tests

@@ -801,13 +952,13 @@
         System.out.println("Testing for missing nest-host attribute");
         String msg = "tried to access method TestNestmateMembership$TargetNoHost.<init>()V" +
             " from class TestNestmateMembership$Caller";
         try {
             Caller.newTargetNoHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "class TestNestmateMembership$Caller cannot access a member of class " +
             "TestNestmateMembership$TargetNoHost with modifiers \"private\"";
         try {

@@ -828,22 +979,69 @@
 
         msg = "tried to access method TestNestmateMembership$Target.<init>()V" +
             " from class TestNestmateMembership$CallerNoHost";
         try {
             CallerNoHost.newTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "tried to access method TestNestmateMembership$TargetNoHost.<init>()V" +
             " from class TestNestmateMembership$CallerNoHost";
         try {
             CallerNoHost.newTargetNoHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+    }
+
+    static void test_SelfHostConstruct() throws Throwable {
+        System.out.println("Testing for class that lists itself as nest-host");
+        String msg = "Type TestNestmateMembership$TargetSelfHost is not a nest member" +
+            " of TestNestmateMembership$TargetSelfHost: current type is not listed as a nest member";
+        try {
+            Caller.newTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        try {
+            Caller.newTargetSelfHostReflectively();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        msg = "no such constructor: TestNestmateMembership$TargetSelfHost.<init>()void/newInvokeSpecial";
+        try {
+            Caller.newTargetSelfHostMH();
+            throw new Error("Missing IllegalAccessException: " + msg);
+        }
+        catch (IllegalAccessException expected) {
+            check_expected(expected, msg);
+        }
+
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.newTarget();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.newTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_MissingHostConstruct() throws Throwable {

@@ -897,23 +1095,23 @@
     }
 
     static void test_NotInstanceHostConstruct() throws Throwable {
         System.out.println("Testing for nest-host class that is not an instance class");
         String msg = "Type TestNestmateMembership$TargetNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             Caller.newTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.newTargetNotInstanceHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "no such constructor: TestNestmateMembership$TargetNotInstanceHost.<init>()void/newInvokeSpecial";
         try {
             Caller.newTargetNotInstanceHostMH();

@@ -922,45 +1120,45 @@
         catch (IllegalAccessException expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.newTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.newTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_NotOurHostConstruct() throws Throwable {
         System.out.println("Testing for nest-host class that does not list us in its nest");
         String msg = "Type TestNestmateMembership$TargetNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             Caller.newTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.newTargetNotOurHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "no such constructor: TestNestmateMembership$TargetNotOurHost.<init>()void/newInvokeSpecial";
         try {
             Caller.newTargetNotOurHostMH();

@@ -969,45 +1167,45 @@
         catch (IllegalAccessException expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.newTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.newTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_WrongPackageHostConstruct() {
         System.out.println("Testing for nest-host and nest-member in different packages");
         String msg = "Type P2.PackagedNestHost2$Member is not a nest member of " +
             "P1.PackagedNestHost: types are in different packages";
         try {
             P1.PackagedNestHost.doConstruct();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             P2.PackagedNestHost2.Member.doConstruct();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     // field tests

@@ -1025,13 +1223,13 @@
         System.out.println("Testing for missing nest-host attribute");
         String msg = "tried to access field TestNestmateMembership$TargetNoHost.f" +
             " from class TestNestmateMembership$Caller";
         try {
             Caller.getFieldTargetNoHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "class TestNestmateMembership$Caller cannot access a member of class " +
             "TestNestmateMembership$TargetNoHost with modifiers \"private static\"";
         try {

@@ -1052,22 +1250,68 @@
 
         msg = "tried to access field TestNestmateMembership$Target.f" +
             " from class TestNestmateMembership$CallerNoHost";
         try {
             CallerNoHost.getFieldTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "tried to access field TestNestmateMembership$TargetNoHost.f" +
             " from class TestNestmateMembership$CallerNoHost";
         try {
             CallerNoHost.getFieldTargetNoHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+    }
+
+    static void test_SelfHostGetField() throws Throwable {
+        System.out.println("Testing for class that lists itself as nest-host");
+        String msg = "Type TestNestmateMembership$TargetSelfHost is not a nest member" +
+            " of TestNestmateMembership$TargetSelfHost: current type is not listed as a nest member";
+        try {
+            Caller.getFieldTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        try {
+            Caller.getFieldTargetSelfHostReflectively();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        try {
+            Caller.getFieldTargetSelfHostMH();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.getFieldTarget();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.getFieldTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_MissingHostGetField() throws Throwable {

@@ -1120,115 +1364,115 @@
     }
 
     static void test_NotInstanceHostGetField() throws Throwable {
         System.out.println("Testing for nest-host class that is not an instance class");
         String msg = "Type TestNestmateMembership$TargetNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             Caller.getFieldTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.getFieldTargetNotInstanceHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.getFieldTargetNotInstanceHostMH();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.getFieldTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.getFieldTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_NotOurHostGetField() throws Throwable {
         System.out.println("Testing for nest-host class that does not list us in its nest");
         String msg = "Type TestNestmateMembership$TargetNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             Caller.getFieldTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.getFieldTargetNotOurHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.getFieldTargetNotOurHostMH();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.getFieldTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.getFieldTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_WrongPackageHostGetField() {
         System.out.println("Testing for nest-host and nest-member in different packages");
         String msg = "Type P2.PackagedNestHost2$Member is not a nest member of " +
             "P1.PackagedNestHost: types are in different packages";
         try {
             P1.PackagedNestHost.doGetField();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             P2.PackagedNestHost2.Member.doGetField();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
    static void test_GoodPutField(){

@@ -1244,13 +1488,13 @@
         System.out.println("Testing for missing nest-host attribute");
         String msg = "tried to access field TestNestmateMembership$TargetNoHost.f" +
             " from class TestNestmateMembership$Caller";
         try {
             Caller.putFieldTargetNoHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "class TestNestmateMembership$Caller cannot access a member of class " +
             "TestNestmateMembership$TargetNoHost with modifiers \"private static\"";
         try {

@@ -1271,22 +1515,68 @@
 
         msg = "tried to access field TestNestmateMembership$Target.f" +
             " from class TestNestmateMembership$CallerNoHost";
         try {
             CallerNoHost.putFieldTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "tried to access field TestNestmateMembership$TargetNoHost.f" +
             " from class TestNestmateMembership$CallerNoHost";
         try {
             CallerNoHost.putFieldTargetNoHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+    }
+
+    static void test_SelfHostPutField() throws Throwable {
+        System.out.println("Testing for class that lists itself as nest-host");
+        String msg = "Type TestNestmateMembership$TargetSelfHost is not a nest member" +
+            " of TestNestmateMembership$TargetSelfHost: current type is not listed as a nest member";
+        try {
+            Caller.putFieldTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        try {
+            Caller.putFieldTargetSelfHostReflectively();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        try {
+            Caller.putFieldTargetSelfHostMH();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.putFieldTarget();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
+            check_expected(expected, msg);
+        }
+        msg = "Type TestNestmateMembership$CallerSelfHost is not a nest member" +
+            " of TestNestmateMembership$CallerSelfHost: current type is not listed as a nest member";
+        try {
+            CallerSelfHost.putFieldTargetSelfHost();
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
+        }
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_MissingHostPutField() throws Throwable {

@@ -1339,115 +1629,115 @@
     }
 
     static void test_NotInstanceHostPutField() throws Throwable {
         System.out.println("Testing for nest-host class that is not an instance class");
         String msg = "Type TestNestmateMembership$TargetNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             Caller.putFieldTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.putFieldTargetNotInstanceHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.putFieldTargetNotInstanceHostMH();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.putFieldTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotInstanceHost is not a "+
-            "nest member of [Ljava.lang.Object;: nest-host is not an instance class";
+            "nest member of [LInvalidNestHost;: current type is not listed as a nest member";
         try {
             CallerNotInstanceHost.putFieldTargetNotInstanceHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_NotOurHostPutField() throws Throwable {
         System.out.println("Testing for nest-host class that does not list us in its nest");
         String msg = "Type TestNestmateMembership$TargetNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             Caller.putFieldTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.putFieldTargetNotOurHostReflectively();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             Caller.putFieldTargetNotOurHostMH();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
 
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.putFieldTarget();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         msg = "Type TestNestmateMembership$CallerNotOurHost is not a nest member" +
-            " of java.lang.Object: current type is not listed as a nest member";
+            " of InvalidNestHost: current type is not listed as a nest member";
         try {
             CallerNotOurHost.putFieldTargetNotOurHost();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     static void test_WrongPackageHostPutField() {
         System.out.println("Testing for nest-host and nest-member in different packages");
         String msg = "Type P2.PackagedNestHost2$Member is not a nest member of " +
             "P1.PackagedNestHost: types are in different packages";
         try {
             P1.PackagedNestHost.doPutField();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
         try {
             P2.PackagedNestHost2.Member.doPutField();
-            throw new Error("Missing IllegalAccessError: " + msg);
+            throw new Error("Missing IncompatibleClassChangeError: " + msg);
         }
-        catch (IllegalAccessError expected) {
+        catch (IncompatibleClassChangeError expected) {
             check_expected(expected, msg);
         }
     }
 
     // utilities
< prev index next >