< prev index next >

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

Print this page




 295 
 296         if (isSuperInterface(proxy.getClass(), c)) {
 297             return;
 298         }
 299 
 300         // disallow any method not declared in one of the proxy interfaces
 301         throw new IllegalArgumentException("Can't handle: " + method);
 302     }
 303 
 304     private static boolean isSuperInterface(Class<?> c, Class<?> intf) {
 305         for (Class<?> i : c.getInterfaces()) {
 306             if (i == intf) {
 307                 return true;
 308             }
 309             if (isSuperInterface(i, intf)) {
 310                 return true;
 311             }
 312         }
 313         return false;
 314     }
 315 
 316     /**
 317      * Checks if {@code Class cls} is a VM-anonymous class
 318      * as defined by {@link jdk.internal.misc.Unsafe#defineAnonymousClass}
 319      * (not to be confused with a Java Language anonymous inner class).
 320      */
 321     public static boolean isVMAnonymousClass(Class<?> cls) {
 322         return cls.getName().indexOf('/') > -1;
 323     }
 324 }


 295 
 296         if (isSuperInterface(proxy.getClass(), c)) {
 297             return;
 298         }
 299 
 300         // disallow any method not declared in one of the proxy interfaces
 301         throw new IllegalArgumentException("Can't handle: " + method);
 302     }
 303 
 304     private static boolean isSuperInterface(Class<?> c, Class<?> intf) {
 305         for (Class<?> i : c.getInterfaces()) {
 306             if (i == intf) {
 307                 return true;
 308             }
 309             if (isSuperInterface(i, intf)) {
 310                 return true;
 311             }
 312         }
 313         return false;
 314     }









 315 }
< prev index next >