changeset 49027:2df42bea77a4 nestmates

8197539: [Nestmates] Revert all changes to VerifyAccess.isSameMemberPackage and Lookup.in behaviour Reviewed-by: mchung
author dholmes
date Tue, 13 Feb 2018 23:51:28 -0500
parents 7557bd88d9a2
children b00f667fb5a6 72292cb3d773
files src/java.base/share/classes/java/lang/invoke/MethodHandles.java src/java.base/share/classes/sun/invoke/util/VerifyAccess.java
diffstat 2 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Feb 13 19:38:04 2018 -0500
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Tue Feb 13 23:51:28 2018 -0500
@@ -829,7 +829,7 @@
             }
             // Allow nestmate lookups to be created without special privilege:
             if ((newModes & PRIVATE) != 0
-                && !VerifyAccess.areNestMates(this.lookupClass, requestedLookupClass)) {
+                && !VerifyAccess.isSamePackageMember(this.lookupClass, requestedLookupClass)) {
                 newModes &= ~(PRIVATE|PROTECTED);
             }
             if ((newModes & PUBLIC) != 0
--- a/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java	Tue Feb 13 19:38:04 2018 -0500
+++ b/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java	Tue Feb 13 23:51:28 2018 -0500
@@ -351,14 +351,11 @@
      * @param class2 another class
      * @return whether they are identical or nested together
      */
-    public static boolean areNestMates(Class<?> class1, Class<?> class2) {
+    public static boolean isSamePackageMember(Class<?> class1, Class<?> class2) {
         if (class1 == class2)
             return true;
         if (!isSamePackage(class1, class2))
             return false;
-        if (Reflection.areNestMates(class1, class2))
-            return true;
-        // Could be pre-nestmate nested types
         if (getOutermostEnclosingClass(class1) != getOutermostEnclosingClass(class2))
             return false;
         return true;