/* *Verifythatitispublic,final,andnotabstract.
*/ int flags = proxyClass.getModifiers();
System.err.println( "+ proxy class's modifiers: " + Modifier.toString(flags)); if (!Modifier.isPublic(flags)) { thrownew RuntimeException("proxy class in not public");
} if (!Modifier.isFinal(flags)) { thrownew RuntimeException("proxy class in not final");
} if (Modifier.isAbstract(flags)) { thrownew RuntimeException("proxy class in abstract");
}
/* *Verifythatitisassignabletotheproxyinterfaces.
*/ for (Class<?> intf : interfaces) { if (!intf.isAssignableFrom(proxyClass)) { thrownew RuntimeException( "proxy class not assignable to proxy interface " +
intf.getName());
}
}
/* *Verifythatsystemagressthatitisaproxyclass.
*/ if (Proxy.isProxyClass(Object.class)) { thrownew RuntimeException( "Proxy.isProxyClass returned true for java.lang.Object");
} if (!Proxy.isProxyClass(proxyClass)) { thrownew RuntimeException( "Proxy.isProxyClass returned false for proxy class");
}
/* *Verifythatitsprotectiondomainisthebootstrapdomain.
*/
ProtectionDomain pd = proxyClass.getProtectionDomain();
System.err.println("+ proxy class's protection domain: " + pd); if (!pd.implies(new AllPermission())) { thrownew RuntimeException( "proxy class does not have AllPermission");
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.