changeset 13586:45cc25e93c6a nestmates

8187567: [Nestmates] Enable nestmate changes in javac by default Summary: Remove compiler directives from tests; add new test for invokeinterface versus invokespecial Reviewed-by: mcimadamore
author dholmes
date Thu, 21 Sep 2017 03:03:43 -0400
parents 64bc704066cd
children 503ddcb96bb0
files test/runtime/Nestmates/membership/TestNestmateMembership.java test/runtime/Nestmates/privateConstructors/TestConstructorHierarchy.java test/runtime/Nestmates/privateConstructors/TestInvokeSpecial.java test/runtime/Nestmates/privateConstructors/TestMethodHandles.java test/runtime/Nestmates/privateFields/TestMethodHandles.java test/runtime/Nestmates/privateFields/TestPrivateField.java test/runtime/Nestmates/privateFields/TestReflection.java test/runtime/Nestmates/privateMethods/StaticIfaceError.jcod test/runtime/Nestmates/privateMethods/StaticIfaceGood.jcod test/runtime/Nestmates/privateMethods/TestInvoke.java test/runtime/Nestmates/privateMethods/TestInvokeErrors.java test/runtime/Nestmates/privateMethods/TestInvokeHierarchy.java test/runtime/Nestmates/privateMethods/TestInvokeInterface.java test/runtime/Nestmates/privateMethods/TestMethodHandles.java test/runtime/Nestmates/privateMethods/TestReflection.java test/runtime/Nestmates/privateStaticFields/TestMethodHandles.java test/runtime/Nestmates/privateStaticFields/TestPrivateStaticField.java test/runtime/Nestmates/privateStaticFields/TestReflection.java test/runtime/Nestmates/privateStaticMethods/TestInvokeStatic.java test/runtime/Nestmates/privateStaticMethods/TestMethodHandles.java test/runtime/Nestmates/privateStaticMethods/TestReflection.java
diffstat 21 files changed, 423 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/test/runtime/Nestmates/membership/TestNestmateMembership.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/membership/TestNestmateMembership.java	Thu Sep 21 03:03:43 2017 -0400
@@ -25,8 +25,7 @@
  * @test
  * @bug 8046171
  * @summary Test the various rules for nest members and nest-tops
- * @compile -XDdisablePrivateAccessors
- *          TestNestmateMembership.java
+ * @compile TestNestmateMembership.java
  *          PackagedNestTop.java
  *          PackagedNestTop2.java
  *          NotAMember2.java
--- a/test/runtime/Nestmates/privateConstructors/TestConstructorHierarchy.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateConstructors/TestConstructorHierarchy.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,7 @@
  * @bug 8046171
  * @summary Test access to private constructors in the hierarchy that are
  * outside the nest
- * @compile -XDdisablePrivateAccessors TestConstructorHierarchy.java
+ * @compile TestConstructorHierarchy.java
  * @compile ExternalSuper.jcod
  *          ExternalSub.jcod
  * @run main TestConstructorHierarchy
--- a/test/runtime/Nestmates/privateConstructors/TestInvokeSpecial.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateConstructors/TestInvokeSpecial.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,9 +26,11 @@
  * @bug 8046171
  * @summary Test access to private constructors between nestmates and nest-top
  *          using different flavours of named nested types that will
- *          generate invokespecial for the calls
- * @compile -XDdisablePrivateAccessors TestInvokeSpecial.java
+ *          generate invokespecial for the calls. The -Xcomp run is a special
+ *          regression test for a compiler assertion that would fire when
+ *          "loading" a nest-top class.
  * @run main TestInvokeSpecial
+ * @run main/othervm -Xcomp TestInvokeSpecial
  */
 
 public class TestInvokeSpecial {
--- a/test/runtime/Nestmates/privateConstructors/TestMethodHandles.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateConstructors/TestMethodHandles.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private constructors between nestmates and nest-top
  *          using different flavours of named nested types using method handles
- * @compile -XDdisablePrivateAccessors TestMethodHandles.java
  * @run main TestMethodHandles
  */
 
@@ -55,19 +54,19 @@
         // The arg is a dummy for overloading purposes
 
         default void doConstruct(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(TestMethodHandles.class, NOARG_T);
             TestMethodHandles obj = (TestMethodHandles) mh.invoke();
             obj = (TestMethodHandles) mh.invokeExact();
         }
         default void doConstruct(TestMethodHandles outer, InnerNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(InnerNested.class, INNER_T);
             InnerNested obj = (InnerNested) mh.invoke(outer);
             obj = (InnerNested) mh.invokeExact(outer);
         }
         default void doConstruct(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(StaticNested.class, NOARG_T);
             StaticNested obj = (StaticNested) mh.invoke();
             obj = (StaticNested) mh.invokeExact();
@@ -82,19 +81,19 @@
         // The arg is a dummy for overloading purposes
 
         public void doConstruct(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(TestMethodHandles.class, NOARG_T);
             TestMethodHandles obj = (TestMethodHandles) mh.invoke();
             obj = (TestMethodHandles) mh.invokeExact();
         }
         public  void doConstruct(TestMethodHandles outer, InnerNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(InnerNested.class, INNER_T);
             InnerNested obj = (InnerNested) mh.invoke(outer);
             obj = (InnerNested) mh.invokeExact(outer);
         }
         public void doConstruct(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(StaticNested.class, NOARG_T);
             StaticNested obj = (StaticNested) mh.invoke();
             obj = (StaticNested) mh.invokeExact();
@@ -109,19 +108,19 @@
         // The arg is a dummy for overloading purposes
 
         public void doConstruct(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(TestMethodHandles.class, NOARG_T);
             TestMethodHandles obj = (TestMethodHandles) mh.invoke();
             obj = (TestMethodHandles) mh.invokeExact();
         }
         public  void doConstruct(TestMethodHandles outer, InnerNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(InnerNested.class, INNER_T);
             InnerNested obj = (InnerNested) mh.invoke(outer);
             obj = (InnerNested) mh.invokeExact(outer);
         }
         public void doConstruct(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findConstructor(StaticNested.class, NOARG_T);
             StaticNested obj = (StaticNested) mh.invoke();
             obj = (StaticNested) mh.invokeExact();
@@ -130,7 +129,7 @@
 
     public static void main(String[] args) throws Throwable {
         // These initial constructions test nest-top access
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findConstructor(TestMethodHandles.class, NOARG_T);
         TestMethodHandles o = (TestMethodHandles) mh.invoke();
         o = (TestMethodHandles) mh.invokeExact();
--- a/test/runtime/Nestmates/privateFields/TestMethodHandles.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateFields/TestMethodHandles.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private fields between nestmates and nest-top
  *          using different flavours of named nested types using method handles
- * @compile -XDdisablePrivateAccessors TestMethodHandles.java
  * @run main TestMethodHandles
  */
 
--- a/test/runtime/Nestmates/privateFields/TestPrivateField.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateFields/TestPrivateField.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private fields between nestmates and nest-top
  *          using different flavours of named nested types
- * @compile -XDdisablePrivateAccessors TestPrivateField.java
  * @run main TestPrivateField
  */
 
--- a/test/runtime/Nestmates/privateFields/TestReflection.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateFields/TestReflection.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private fields between nestmates and nest-top
  *          using different flavours of named nested types using core reflection
- * @compile -XDdisablePrivateAccessors TestReflection.java
  * @run main TestReflection
  */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/Nestmates/privateMethods/StaticIfaceError.jcod	Thu Sep 21 03:03:43 2017 -0400
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Generated from the source in TestInvokeInterface.java, compiled for
+// nestmates, but edited to set classfile version back to 52 - where
+// use of invokeinterface for private interface methods is not permitted.
+
+class TestInvokeInterface$StaticIface {
+  0xCAFEBABE;
+  0; // minor version
+  52; // version
+  [] { // Constant Pool
+    ; // first element is empty
+    Field #19 #20; // #1
+    String #21; // #2
+    Method #22 #23; // #3
+    InterfaceMethod #5 #24; // #4
+    class #25; // #5
+    class #26; // #6
+    Utf8 "priv_invoke"; // #7
+    Utf8 "()V"; // #8
+    Utf8 "Code"; // #9
+    Utf8 "LineNumberTable"; // #10
+    Utf8 "access_priv"; // #11
+    Utf8 "StaticIface"; // #12
+    Utf8 "InnerClasses"; // #13
+    Utf8 "(LTestInvokeInterface$StaticIface;)V"; // #14
+    Utf8 "SourceFile"; // #15
+    Utf8 "TestInvokeInterface.java"; // #16
+    Utf8 "MemberOfNest"; // #17
+    class #27; // #18
+    class #28; // #19
+    NameAndType #29 #30; // #20
+    Utf8 "StaticIface::priv_invoke"; // #21
+    class #31; // #22
+    NameAndType #32 #33; // #23
+    NameAndType #7 #8; // #24
+    Utf8 "TestInvokeInterface$StaticIface"; // #25
+    Utf8 "java/lang/Object"; // #26
+    Utf8 "TestInvokeInterface"; // #27
+    Utf8 "java/lang/System"; // #28
+    Utf8 "out"; // #29
+    Utf8 "Ljava/io/PrintStream;"; // #30
+    Utf8 "java/io/PrintStream"; // #31
+    Utf8 "println"; // #32
+    Utf8 "(Ljava/lang/String;)V"; // #33
+  } // Constant Pool
+
+  0x0600; // access
+  #5;// this_cpx
+  #6;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0002; // access
+      #7; // name_cpx
+      #8; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          2; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB200011202B60003;
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  42;
+                8  43;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0001; // access
+      #11; // name_cpx
+      #14; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          1; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2BB900040100B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  46;
+                6  47;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#15) { // SourceFile
+      #16;
+    } // end SourceFile
+    ;
+    Attr(#17) { // MemberOfNest
+      0x0012;
+    } // end MemberOfNest
+    ;
+    Attr(#13) { // InnerClasses
+      [] { // InnerClasses
+        #5 #18 #12 1544;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class TestInvokeInterface$StaticIface
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/Nestmates/privateMethods/StaticIfaceGood.jcod	Thu Sep 21 03:03:43 2017 -0400
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// Generated from the source in TestInvokeInterface.java, compiled for
+// nestmates. The code is not modified from that but exists as a jcod file
+// to ensure we don't accidentally compile it dynamically for the wrong
+// release.
+
+class TestInvokeInterface$StaticIface {
+  0xCAFEBABE;
+  0; // minor version
+  53; // version - FXME: will need to be real nestmate release version
+  [] { // Constant Pool
+    ; // first element is empty
+    Field #19 #20; // #1
+    String #21; // #2
+    Method #22 #23; // #3
+    InterfaceMethod #5 #24; // #4
+    class #25; // #5
+    class #26; // #6
+    Utf8 "priv_invoke"; // #7
+    Utf8 "()V"; // #8
+    Utf8 "Code"; // #9
+    Utf8 "LineNumberTable"; // #10
+    Utf8 "access_priv"; // #11
+    Utf8 "StaticIface"; // #12
+    Utf8 "InnerClasses"; // #13
+    Utf8 "(LTestInvokeInterface$StaticIface;)V"; // #14
+    Utf8 "SourceFile"; // #15
+    Utf8 "TestInvokeInterface.java"; // #16
+    Utf8 "MemberOfNest"; // #17
+    class #27; // #18
+    class #28; // #19
+    NameAndType #29 #30; // #20
+    Utf8 "StaticIface::priv_invoke"; // #21
+    class #31; // #22
+    NameAndType #32 #33; // #23
+    NameAndType #7 #8; // #24
+    Utf8 "TestInvokeInterface$StaticIface"; // #25
+    Utf8 "java/lang/Object"; // #26
+    Utf8 "TestInvokeInterface"; // #27
+    Utf8 "java/lang/System"; // #28
+    Utf8 "out"; // #29
+    Utf8 "Ljava/io/PrintStream;"; // #30
+    Utf8 "java/io/PrintStream"; // #31
+    Utf8 "println"; // #32
+    Utf8 "(Ljava/lang/String;)V"; // #33
+  } // Constant Pool
+
+  0x0600; // access
+  #5;// this_cpx
+  #6;// super_cpx
+
+  [] { // Interfaces
+  } // Interfaces
+
+  [] { // fields
+  } // fields
+
+  [] { // methods
+    { // Member
+      0x0002; // access
+      #7; // name_cpx
+      #8; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          2; // max_stack
+          1; // max_locals
+          Bytes[]{
+            0xB200011202B60003;
+            0xB1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  42;
+                8  43;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+    ;
+    { // Member
+      0x0001; // access
+      #11; // name_cpx
+      #14; // sig_cpx
+      [] { // Attributes
+        Attr(#9) { // Code
+          1; // max_stack
+          2; // max_locals
+          Bytes[]{
+            0x2BB900040100B1;
+          };
+          [] { // Traps
+          } // end Traps
+          [] { // Attributes
+            Attr(#10) { // LineNumberTable
+              [] { // LineNumberTable
+                0  46;
+                6  47;
+              }
+            } // end LineNumberTable
+          } // Attributes
+        } // end Code
+      } // Attributes
+    } // Member
+  } // methods
+
+  [] { // Attributes
+    Attr(#15) { // SourceFile
+      #16;
+    } // end SourceFile
+    ;
+    Attr(#17) { // MemberOfNest
+      0x0012;
+    } // end MemberOfNest
+    ;
+    Attr(#13) { // InnerClasses
+      [] { // InnerClasses
+        #5 #18 #12 1544;
+      }
+    } // end InnerClasses
+  } // Attributes
+} // end class TestInvokeInterface$StaticIface
--- a/test/runtime/Nestmates/privateMethods/TestInvoke.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateMethods/TestInvoke.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,8 +26,7 @@
  * @bug 8046171
  * @summary Test access to private methods between nestmates and nest-top
  *          using different flavours of named nested types
- * @compile -XDdisablePrivateAccessors TestInvoke.java
- * @run main TestInvoke
+  * @run main TestInvoke
  */
 
 public class TestInvoke {
@@ -113,6 +112,9 @@
         // public constructor so we aren't relying on private access
         public InnerNested() {}
 
+        void access_priv() {
+            TestInvoke.this.priv_invoke(); // check this$0 access
+        }
         void access_priv(TestInvoke o) {
             o.priv_invoke();
         }
@@ -143,6 +145,7 @@
         s.access_priv(new StaticNested());
         s.access_priv(intf);
 
+        i.access_priv();
         i.access_priv(o);
         i.access_priv(o.new InnerNested());
         i.access_priv(s);
--- a/test/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateMethods/TestInvokeErrors.java	Thu Sep 21 03:03:43 2017 -0400
@@ -27,7 +27,7 @@
  * @summary Setup nestmate calls to private methods then use
  *          modified jcod classes to introduce errors. Test with
  *          and without verification enabled
- * @compile -XDdisablePrivateAccessors TestInvokeErrors.java
+ * @compile TestInvokeErrors.java
  * @compile MissingMethod.jcod
  *          MissingMethodWithSuper.jcod
  *          MissingNestTop.jcod
--- a/test/runtime/Nestmates/privateMethods/TestInvokeHierarchy.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateMethods/TestInvokeHierarchy.java	Thu Sep 21 03:03:43 2017 -0400
@@ -27,7 +27,7 @@
  * @summary Test access to private methods between nestmates where there
  *          is an inheritance hierarchy and we invoke private methods that
  *          exist in specific classes in the hierarchy.
- * @compile -XDdisablePrivateAccessors TestInvokeHierarchy.java
+ * @compile TestInvokeHierarchy.java
  * @compile ExternalSuper.jcod ExternalSub.jcod
  * @run main TestInvokeHierarchy
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/runtime/Nestmates/privateMethods/TestInvokeInterface.java	Thu Sep 21 03:03:43 2017 -0400
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// We compile two versions of the nested StaticIface which contains a call
+// to a private interface method. Both versions are compiled to use
+// invokeinterface, but one is modified to declare a lower classfile version,
+// which makes the use of invokeinterface illegal in that context.
+// We run the test twice, each time using a different version of the
+// StaticIface class.
+
+/*
+ * @test
+ * @bug 8046171
+ * @summary Test use of invokeinterface versus invokespecial for private
+ *          interface method invocation
+ * @compile TestInvokeInterface.java
+ * @compile StaticIfaceGood.jcod
+ * @run main TestInvokeInterface pass
+ * @compile StaticIfaceError.jcod
+ * @run main TestInvokeInterface fail
+ */
+
+public class TestInvokeInterface {
+
+    static interface StaticIface {
+
+        private void priv_invoke() {
+            System.out.println("StaticIface::priv_invoke");
+        }
+
+        default void access_priv(StaticIface o) {
+            o.priv_invoke();
+        }
+    }
+
+    public static void main(String[] args) {
+        boolean shouldFail = args[0].equals("fail");
+        String icce = "IncompatibleClassChangeError: private interface method requires invokespecial";
+        StaticIface intf = new StaticIface() {};
+        try {
+            intf.access_priv(new StaticIface(){});
+            if (shouldFail)
+                throw new Error("Do not get expected exception: " + icce);
+            else
+                System.out.println("Invocation succeeded as expected");
+        }
+        catch (IncompatibleClassChangeError e) {
+            if (shouldFail && e.toString().contains(icce))
+                System.out.println("Got expected exception: " + e);
+            else
+                throw new Error("Unexpected cause of exception: " + e);
+        }
+    }
+}
--- a/test/runtime/Nestmates/privateMethods/TestMethodHandles.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateMethods/TestMethodHandles.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private methods between nestmates and nest-top
  *          using different flavours of named nested types using MethodHandles
- * @compile -XDdisablePrivateAccessors TestMethodHandles.java
  * @run main TestMethodHandles
  */
 
@@ -50,7 +49,7 @@
     // Methods that will access private methods of nestmates
 
     void access_priv(TestMethodHandles o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
         mh.invoke(o);
         mh.invokeExact(o);
@@ -58,7 +57,7 @@
         checkBadInvoke(mh, mh); // completely wrong type
     }
     void access_priv(InnerNested o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
         mh.invoke(o);
         mh.invokeExact(o);
@@ -66,7 +65,7 @@
         checkBadInvoke(mh, mh); // completely wrong type
     }
     void access_priv(StaticNested o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
         mh.invoke(o);
         mh.invokeExact(o);
@@ -74,7 +73,7 @@
         checkBadInvoke(mh, mh); // completely wrong type
     }
     void access_priv(StaticIface o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findSpecial(StaticIface.class, "priv_invoke", M_T, this.getClass());
         mh.invoke(o);
         mh.invokeExact(o);
@@ -93,7 +92,7 @@
         // Methods that will access private methods of nestmates
 
         default void access_priv(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, StaticIface.class);
             mh.invoke(o);
             mh.invokeExact(o);
@@ -101,7 +100,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         default void access_priv(InnerNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, StaticIface.class);
             mh.invoke(o);
             mh.invokeExact(o);
@@ -109,7 +108,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         default void access_priv(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, StaticIface.class);
             mh.invoke(o);
             mh.invokeExact(o);
@@ -117,7 +116,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         default void access_priv(StaticIface o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(StaticIface.class, "priv_invoke", M_T, StaticIface.class);
             mh.invoke(o);
             mh.invokeExact(o);
@@ -138,7 +137,7 @@
         // Methods that will access private methods of nestmates
 
         void access_priv(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -146,7 +145,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         void access_priv(InnerNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -154,7 +153,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         void access_priv(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -162,7 +161,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         void access_priv(StaticIface o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(StaticIface.class, "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -181,7 +180,7 @@
         public InnerNested() {}
 
         void access_priv(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -189,7 +188,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         void access_priv(InnerNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -197,7 +196,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         void access_priv(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(o.getClass(), "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
@@ -205,7 +204,7 @@
             checkBadInvoke(mh, mh); // completely wrong type
         }
         void access_priv(StaticIface o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findSpecial(StaticIface.class, "priv_invoke", M_T, this.getClass());
             mh.invoke(o);
             mh.invokeExact(o);
--- a/test/runtime/Nestmates/privateMethods/TestReflection.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateMethods/TestReflection.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private methods between nestmates and nest-top
  *          using different flavours of named nested types using core reflection
- * @compile -XDdisablePrivateAccessors TestReflection.java
  * @run main TestReflection
  */
 
--- a/test/runtime/Nestmates/privateStaticFields/TestMethodHandles.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateStaticFields/TestMethodHandles.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private static fields between nestmates and nest-top
  *          using different flavours of named nested types using core reflection
- * @compile -XDdisablePrivateAccessors TestMethodHandles.java
  * @run main TestMethodHandles
  */
 
@@ -84,7 +83,7 @@
             MethodHandle mh = lookup().findStaticGetter(o.getClass(), "priv_field", int.class);
             int priv_field = (int) mh.invoke();
             priv_field = (int) mh.invokeExact();
-			mh = lookup().findStaticSetter(o.getClass(), "priv_field", int.class);
+            mh = lookup().findStaticSetter(o.getClass(), "priv_field", int.class);
             mh.invoke(2);
             mh.invokeExact(3);
         }
@@ -140,7 +139,7 @@
         }
     }
 
-	public static void main(String[] args) throws Throwable {
+    public static void main(String[] args) throws Throwable {
         TestMethodHandles o = new TestMethodHandles();
         StaticNested s = new StaticNested();
         InnerNested i = o.new InnerNested();
--- a/test/runtime/Nestmates/privateStaticFields/TestPrivateStaticField.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateStaticFields/TestPrivateStaticField.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private static fields between nestmates and nest-top
  *          using different flavours of named nested types
- * @compile -XDdisablePrivateAccessors TestPrivateStaticField.java
  * @run main TestPrivateStaticField
  */
 
@@ -41,7 +40,7 @@
     // Methods that will access private static fields of nestmates
     // We use the arguments for overloading purposes and use the fact
     // you can access a static field through an object reference for
-    // convenience. 
+    // convenience.
 
     // NOTE: No InnerNested calls in this test because non-static nested types
     // can't have static fields. Also no StaticIface calls as static interface
--- a/test/runtime/Nestmates/privateStaticFields/TestReflection.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateStaticFields/TestReflection.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private static fields between nestmates and nest-top
  *          using different flavours of named nested types using core reflection
- * @compile -XDdisablePrivateAccessors TestReflection.java
  * @run main TestReflection
  */
 
--- a/test/runtime/Nestmates/privateStaticMethods/TestInvokeStatic.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateStaticMethods/TestInvokeStatic.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private static methods between nestmates and nest-top
  *          using different flavours of named nested types
- * @compile -XDdisablePrivateAccessors TestInvokeStatic.java
  * @run main TestInvokeStatic
  */
 
--- a/test/runtime/Nestmates/privateStaticMethods/TestMethodHandles.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateStaticMethods/TestMethodHandles.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private static methods between nestmates and nest-top
  *          using different flavours of named nested types using MethodHandles
- * @compile -XDdisablePrivateAccessors TestMethodHandles.java
  * @run main TestMethodHandles
  */
 
@@ -53,19 +52,19 @@
     // can't have static methods
 
     void access_priv(TestMethodHandles o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
         mh.invoke();
         mh.invokeExact();
     }
     void access_priv(StaticNested o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
         mh.invoke();
         mh.invokeExact();
     }
     void access_priv(StaticIface o) throws Throwable {
-        MethodHandle mh = 
+        MethodHandle mh =
           lookup().findStatic(StaticIface.class, "priv_static_invoke", INVOKE_T);
         mh.invoke();
         mh.invokeExact();
@@ -82,19 +81,19 @@
         // Methods that will access private static methods of nestmates
 
         default void access_priv(TestMethodHandles o) throws Throwable {
-          MethodHandle mh = 
+          MethodHandle mh =
             lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
           mh.invoke();
           mh.invokeExact();
         }
         default void access_priv(StaticNested o) throws Throwable {
-          MethodHandle mh = 
+          MethodHandle mh =
             lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
           mh.invoke();
           mh.invokeExact();
         }
         default void access_priv(StaticIface o) throws Throwable {
-          MethodHandle mh = 
+          MethodHandle mh =
             lookup().findStatic(StaticIface.class, "priv_static_invoke", INVOKE_T);
           mh.invoke();
           mh.invokeExact();
@@ -113,19 +112,19 @@
         // Methods that will access private static methods of nestmates
 
         void access_priv(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
           mh.invoke();
           mh.invokeExact();
         }
         void access_priv(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
           mh.invoke();
           mh.invokeExact();
         }
         void access_priv(StaticIface o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findStatic(StaticIface.class, "priv_static_invoke", INVOKE_T);
           mh.invoke();
           mh.invokeExact();
@@ -138,19 +137,19 @@
         public InnerNested() {}
 
         void access_priv(TestMethodHandles o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
             mh.invoke();
             mh.invokeExact();
         }
         void access_priv(StaticNested o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findStatic(o.getClass(), "priv_static_invoke", INVOKE_T);
             mh.invoke();
             mh.invokeExact();
         }
         void access_priv(StaticIface o) throws Throwable {
-            MethodHandle mh = 
+            MethodHandle mh =
               lookup().findStatic(StaticIface.class, "priv_static_invoke", INVOKE_T);
             mh.invoke();
             mh.invokeExact();
--- a/test/runtime/Nestmates/privateStaticMethods/TestReflection.java	Thu Sep 21 03:02:38 2017 -0400
+++ b/test/runtime/Nestmates/privateStaticMethods/TestReflection.java	Thu Sep 21 03:03:43 2017 -0400
@@ -26,7 +26,6 @@
  * @bug 8046171
  * @summary Test access to private static methods between nestmates and nest-top
  *          using different flavours of named nested types using core reflection
- * @compile -XDdisablePrivateAccessors TestReflection.java
  * @run main TestReflection
  */