diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java index 41701876..68eb9baa 100644 --- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java +++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java @@ -1246,6 +1246,13 @@ Set getSyntheticInnerClasses() { return Collections.unmodifiableSet(this.getState().getSyntheticInnerClasses()); } + /** + * True if there are any user-defined inner classes for this mixin + */ + boolean hasInnerClasses() { + return !this.getState().getInnerClasses().isEmpty(); + } + /** * Get the user-defined inner classes for this mixin */ diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java index 5be4f8f2..7a304949 100644 --- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java +++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java @@ -201,11 +201,12 @@ final MixinPreProcessorStandard prepare(Extensions extensions) { } protected void prepareInnerClasses(Extensions extensions) { - InnerClassGenerator icg = extensions.getGenerator(InnerClassGenerator.class); - for (String targetClassName : this.mixin.getDeclaredTargetClasses()) { - ClassInfo targetClassInfo = ClassInfo.forName(targetClassName); - for (String innerClass : this.mixin.getInnerClasses()) { - icg.registerInnerClass(this.mixin, targetClassInfo, innerClass); + if (this.mixin.hasInnerClasses()) { + InnerClassGenerator icg = extensions.getGenerator(InnerClassGenerator.class); + for (ClassInfo targetClassInfo : this.mixin.getTargets()) { + for (String innerClass : this.mixin.getInnerClasses()) { + icg.registerInnerClass(this.mixin, targetClassInfo, innerClass); + } } } }