Review Request: JDK-8228671: Fastdebug VM throws InternalError when is used to resolve a member

Mandy Chung mandy.chung at
Fri Jul 26 21:12:42 UTC 2019

Debug VM checks if a class is accessible to the lookup class except if 
the lookup class is java.lang.Object (which was the lookup class of 
publicLookup previously). WithJDK-8173978, Lookup::in has changed and it 
can be used to create a new public Lookup on a different lookup class.

A quick fix for this bug is to pass Object.class for resolution for a 
Lookup object with UNCONDITIONAL mode as previously.  The lookup class 
and allowed modes are used to check if the resolved member is accessible 
to this Lookup object.  We should re-examine this area in particular 
publicLookup (see JDK-8173977).

diff --git 
--- a/src/java.base/share/classes/java/lang/invoke/
+++ b/src/java.base/share/classes/java/lang/invoke/
@@ -1329,7 +1329,14 @@

          // This is just for calling out to MethodHandleImpl.
          private Class<?> lookupClassOrNull() {
-            return (allowedModes == TRUSTED) ? null : lookupClass;
+            if (allowedModes == TRUSTED) {
+                return null;
+            }
+            if (allowedModes == UNCONDITIONAL) {
+                // use Object as the caller to pass to VM doing resolution
+                return Object.class;
+            }
+            return lookupClass;

          /** Tells which access-protection classes of members this 
lookup object can produce.


More information about the core-libs-dev mailing list