diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/InjectorGroupInfo.java b/src/main/java/org/spongepowered/asm/mixin/injection/InjectorGroupInfo.java index 9742c3a0..07f9697b 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/InjectorGroupInfo.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/InjectorGroupInfo.java @@ -48,7 +48,7 @@ public class InjectorGroupInfo { private static final long serialVersionUID = 1L; - private static final InjectorGroupInfo NO_GROUP = new InjectorGroupInfo("NONE"); + private static final InjectorGroupInfo NO_GROUP = new InjectorGroupInfo("NONE", true); @Override public InjectorGroupInfo get(Object key) { @@ -138,6 +138,11 @@ public class InjectorGroupInfo { */ private final List members = new ArrayList(); + /** + * True if this is the default group + */ + private final boolean isDefault; + /** * Number of callbacks we require injected across this group */ @@ -147,9 +152,14 @@ public class InjectorGroupInfo { * Maximum number of callbacks allowed across this group */ private int maxCallbackCount = Integer.MAX_VALUE; - + public InjectorGroupInfo(String name) { + this(name, false); + } + + InjectorGroupInfo(String name, boolean flag) { this.name = name; + this.isDefault = flag; } @Override @@ -157,6 +167,10 @@ public class InjectorGroupInfo { return String.format("@Group(name=%s, min=%d, max=%d)", this.getName(), this.getMinRequired(), this.getMaxAllowed()); } + public boolean isDefault() { + return this.isDefault; + } + public String getName() { return this.name; } diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java b/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java index 3297e6a0..2d65e8dd 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java @@ -134,7 +134,6 @@ public abstract class InjectionInfo { this.annotationType = annotation.desc.substring(annotation.desc.lastIndexOf('/') + 1).replace(";", ""); this.classNode = mixin.getTargetClass(); this.isStatic = ASMHelper.methodIsStatic(method); - this.requiredCallbackCount = mixin.getDefaultRequiredInjections(); this.readAnnotation(); } @@ -195,6 +194,8 @@ public abstract class InjectionInfo { Integer require = ASMHelper.getAnnotationValue(this.annotation, "require"); if (require != null) { this.requiredCallbackCount = require.intValue(); + } else if (this.group.isDefault()) { + this.requiredCallbackCount = this.mixin.getDefaultRequiredInjections(); } this.injector = this.initInjector(this.annotation);