< prev index next >

src/java.base/share/classes/jdk/internal/foreign/Util.java

Print this page

        

@@ -393,11 +393,12 @@
         }
     }
 
     public static MethodHandle getCallbackMH(Method m) {
         try {
-            MethodHandle mh = MethodHandles.publicLookup().unreflect(m);
+            m.setAccessible(true);
+            MethodHandle mh = MethodHandles.lookup().unreflect(m);
             Util.checkNoArrays(mh.type());
             return mh;
         } catch (Throwable ex) {
             throw new IllegalStateException(ex);
         }
< prev index next >