diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java index 266bb45e..87175da6 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/reflect/compiler/StructureCompiler.java @@ -186,6 +186,15 @@ public final class StructureCompiler { } } + /** + * Retrieve a variable identifier that can uniquely represent the given type. + * @param type - a type. + * @return A unique and legal identifier for the given type. + */ + private String getSafeTypeName(Class type) { + return type.getCanonicalName().replace("[]", "Array").replace(".", "_"); + } + private Class generateClass(StructureModifier source) { ClassWriter cw = new ClassWriter(0); @@ -193,7 +202,9 @@ public final class StructureCompiler { @SuppressWarnings("rawtypes") Class targetType = source.getTargetType(); - String className = "CompiledStructure$" + targetType.getSimpleName() + source.getFieldType().getSimpleName(); + String className = "CompiledStructure$" + + getSafeTypeName(targetType) + "$" + + getSafeTypeName(source.getFieldType()); String targetSignature = Type.getDescriptor(targetType); String targetName = targetType.getName().replace('.', '/');