2013-07-16 17:58:02 +10:00
|
|
|
package codechicken.lib.asm;
|
|
|
|
|
|
|
|
|
|
import org.objectweb.asm.ClassWriter;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class CC_ClassWriter extends ClassWriter
|
|
|
|
|
{
|
2013-07-23 16:04:41 +10:00
|
|
|
private final boolean runtime;
|
|
|
|
|
|
2013-07-16 17:58:02 +10:00
|
|
|
public CC_ClassWriter(int flags)
|
2013-07-23 16:04:41 +10:00
|
|
|
{
|
|
|
|
|
this(flags, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public CC_ClassWriter(int flags, boolean runtime)
|
2013-07-16 17:58:02 +10:00
|
|
|
{
|
|
|
|
|
super(flags);
|
2013-07-23 16:04:41 +10:00
|
|
|
this.runtime = runtime;
|
2013-07-16 17:58:02 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected String getCommonSuperClass(String type1, String type2)
|
|
|
|
|
{
|
|
|
|
|
String c = type1.replace('/', '.');
|
|
|
|
|
String d = type2.replace('/', '.');
|
|
|
|
|
if(ClassHeirachyManager.classExtends(d, c))
|
|
|
|
|
return type1;
|
|
|
|
|
if(ClassHeirachyManager.classExtends(c, d))
|
|
|
|
|
return type2;
|
|
|
|
|
do
|
|
|
|
|
{
|
2013-07-23 16:04:41 +10:00
|
|
|
c = ClassHeirachyManager.getSuperClass(c, runtime);
|
2013-07-16 17:58:02 +10:00
|
|
|
}
|
|
|
|
|
while(!ClassHeirachyManager.classExtends(d, c));
|
|
|
|
|
return c.replace('.', '/');
|
|
|
|
|
}
|
|
|
|
|
}
|