Commit 73997f46 authored by mbenson's avatar mbenson
Browse files

Resolve "Enhance ClassWriter to take a class loader for use with getCommonSuperClass"

parent 23337ecf
...@@ -849,7 +849,7 @@ public class ClassWriter extends ClassVisitor { ...@@ -849,7 +849,7 @@ public class ClassWriter extends ClassVisitor {
* @return the internal name of the common super class of the two given classes. * @return the internal name of the common super class of the two given classes.
*/ */
protected String getCommonSuperClass(final String type1, final String type2) { protected String getCommonSuperClass(final String type1, final String type2) {
ClassLoader classLoader = getClass().getClassLoader(); ClassLoader classLoader = getClassLoader();
Class<?> class1; Class<?> class1;
try { try {
class1 = Class.forName(type1.replace('/', '.'), false, classLoader); class1 = Class.forName(type1.replace('/', '.'), false, classLoader);
...@@ -877,4 +877,15 @@ public class ClassWriter extends ClassVisitor { ...@@ -877,4 +877,15 @@ public class ClassWriter extends ClassVisitor {
return class1.getName().replace('.', '/'); return class1.getName().replace('.', '/');
} }
} }
/**
* Returns the {@link ClassLoader} to be used by the default implementation of {@link
* #getCommonSuperClass(String, String)}, that of this {@link ClassWriter}'s runtime type by
* default.
*
* @return ClassLoader
*/
protected ClassLoader getClassLoader() {
return getClass().getClassLoader();
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment