src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke


 320         }
 321 
 322         // disallow any method not declared in one of the proxy interfaces
 323         throw new IllegalArgumentException("Can't handle: " + method);
 324     }
 325 
 326     private static boolean isSuperInterface(Class<?> c, Class<?> intf) {
 327         for (Class<?> i : c.getInterfaces()) {
 328             if (i == intf) {
 329                 return true;
 330             }
 331             if (isSuperInterface(i, intf)) {
 332                 return true;
 333             }
 334         }
 335         return false;
 336     }
 337 
 338     /**
 339      * Checks if {@code Class cls} is a VM-anonymous class
 340      * as defined by {@link sun.misc.Unsafe#defineAnonymousClass}
 341      * (not to be confused with a Java Language anonymous inner class).
 342      */
 343     public static boolean isVMAnonymousClass(Class<?> cls) {
 344         return cls.getName().indexOf('/') > -1;
 345     }
 346 }


 320         }
 321 
 322         // disallow any method not declared in one of the proxy interfaces
 323         throw new IllegalArgumentException("Can't handle: " + method);
 324     }
 325 
 326     private static boolean isSuperInterface(Class<?> c, Class<?> intf) {
 327         for (Class<?> i : c.getInterfaces()) {
 328             if (i == intf) {
 329                 return true;
 330             }
 331             if (isSuperInterface(i, intf)) {
 332                 return true;
 333             }
 334         }
 335         return false;
 336     }
 337 
 338     /**
 339      * Checks if {@code Class cls} is a VM-anonymous class
 340      * as defined by {@link jdk.internal.misc.Unsafe#defineAnonymousClass}
 341      * (not to be confused with a Java Language anonymous inner class).
 342      */
 343     public static boolean isVMAnonymousClass(Class<?> cls) {
 344         return cls.getName().indexOf('/') > -1;
 345     }
 346 }