in asm/src/main/java/org/apache/commons/proxy2/asm/ASMProxyFactory.java [305:336]
private static Class<?> loadClass(final ClassLoader loader, String className, byte[] b)
{
// override classDefine (as it is protected) and define the class.
try
{
final Method method = ClassLoader.class.getDeclaredMethod("defineClass", String.class, byte[].class,
int.class, int.class);
// protected method invocation
final boolean accessible = method.isAccessible();
if (!accessible)
{
method.setAccessible(true);
}
try
{
return (Class<?>) method
.invoke(loader, className, b, Integer.valueOf(0), Integer.valueOf(b.length));
}
finally
{
if (!accessible)
{
method.setAccessible(false);
}
}
}
catch (Exception e)
{
throw e instanceof RuntimeException ? ((RuntimeException) e) : new RuntimeException(e);
}
}