mirror of
https://github.com/dmulloy2/ProtocolLib.git
synced 2024-09-27 14:52:52 +02:00
Just in case, try to load the generated class first.
We might have generated it from a previous run.
This commit is contained in:
parent
42303ae0fc
commit
2012698275
@ -42,7 +42,7 @@ import net.sf.cglib.asm.*;
|
|||||||
// case 6: return (TField) (Object) target.g;
|
// case 6: return (TField) (Object) target.g;
|
||||||
// case 7: return (TField) (Object) target.h;
|
// case 7: return (TField) (Object) target.h;
|
||||||
// default:
|
// default:
|
||||||
// throw new IllegalArgumentException("Invalid index " + fieldIndex);
|
// throw new FieldAccessException("Invalid index " + fieldIndex);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@ -61,7 +61,7 @@ import net.sf.cglib.asm.*;
|
|||||||
// case 6: target.g = (Byte) value; break;
|
// case 6: target.g = (Byte) value; break;
|
||||||
// case 7: target.h = (Integer) value; break;
|
// case 7: target.h = (Integer) value; break;
|
||||||
// default:
|
// default:
|
||||||
// throw new IllegalArgumentException("Invalid index " + index);
|
// throw new FieldAccessException("Invalid index " + index);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // Chaining
|
// // Chaining
|
||||||
@ -181,6 +181,16 @@ public final class StructureCompiler {
|
|||||||
String targetSignature = Type.getDescriptor(targetType);
|
String targetSignature = Type.getDescriptor(targetType);
|
||||||
String targetName = targetType.getName().replace('.', '/');
|
String targetName = targetType.getName().replace('.', '/');
|
||||||
|
|
||||||
|
try {
|
||||||
|
// This class might have been generated before. Try to load it.
|
||||||
|
Class<?> before = loader.loadClass(PACKAGE_NAME.replace('/', '.') + "." + className);
|
||||||
|
|
||||||
|
if (before != null)
|
||||||
|
return before;
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
// That's ok.
|
||||||
|
}
|
||||||
|
|
||||||
cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, PACKAGE_NAME + "/" + className,
|
cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, PACKAGE_NAME + "/" + className,
|
||||||
"<TField:Ljava/lang/Object;>L" + COMPILED_CLASS + "<TTField;>;",
|
"<TField:Ljava/lang/Object;>L" + COMPILED_CLASS + "<TTField;>;",
|
||||||
COMPILED_CLASS, null);
|
COMPILED_CLASS, null);
|
||||||
|
Loading…
Reference in New Issue
Block a user