no
/**
* @param info Injection info
- * @param print
+ * @param print True to print this injector's discovered LVT
+ * @param discriminator discriminator
*/
public ModifyVariableInjector(InjectionInfo info, boolean print, LocalVariableDiscriminator discriminator) {
super(info);
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.java
index 7c82e70df..d14821600 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.java
@@ -65,7 +65,7 @@
*
*
*
- * Matching array access:
+ *
Matching array access:
* For array fields, it is possible to match field accesses followed by a
* corresponding array element get or set operation. To enable
* this behaviour specify the array named-argument with the desired
@@ -86,6 +86,9 @@
@AtCode("FIELD")
public class BeforeFieldAccess extends BeforeInvoke {
+ /**
+ * Default fuzz factor for searching for array access opcodes
+ */
public static final int ARRAY_SEARCH_FUZZ_DEFAULT = 8;
/**
@@ -153,6 +156,20 @@ protected boolean addInsn(InsnList insns, Collection nodes, Ab
return super.addInsn(insns, nodes, insn);
}
+ /**
+ * Searches for an array access instruction in the supplied instruction list
+ * which is within searchRange instructions of the supplied field
+ * instruction. Searching halts if the search range is exhausted, if an
+ * {@link Opcodes#ARRAYLENGTH} opcode is encountered immediately after the
+ * specified access, if a matching field access is found, or if the end of
+ * the method is reached.
+ *
+ * @param insns Instruction list to search
+ * @param fieldNode Field instruction to search from
+ * @param opcode array access opcode to search for
+ * @param searchRange search range
+ * @return matching opcode or null if not matched
+ */
public static AbstractInsnNode findArrayNode(InsnList insns, FieldInsnNode fieldNode, int opcode, int searchRange) {
int pos = 0;
for (Iterator iter = insns.iterator(insns.indexOf(fieldNode) + 1); iter.hasNext();) {
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.java
index b14b2eee4..961641908 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.java
@@ -58,12 +58,12 @@
@AtCode("TAIL")
public class BeforeFinalReturn extends InjectionPoint {
- private final IMixinContext mixin;
+ private final IMixinContext context;
public BeforeFinalReturn(InjectionPointData data) {
super(data);
- this.mixin = data.getMixin();
+ this.context = data.getContext();
}
@Override
@@ -83,7 +83,7 @@ public boolean find(String desc, InsnList insns, Collection no
// WAT?
if (ret == null) {
- throw new InvalidInjectionException(this.mixin, "TAIL could not locate a valid RETURN in the target method!");
+ throw new InvalidInjectionException(this.context, "TAIL could not locate a valid RETURN in the target method!");
}
nodes.add(ret);
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java
index a4be0f555..5cbf77dbd 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java
@@ -102,6 +102,12 @@ private String getClassName() {
return String.format("@At(%s)", atCode != null ? atCode.value() : this.getClass().getSimpleName().toUpperCase());
}
+ /**
+ * Set the logging state for this injector
+ *
+ * @param logging logging state
+ * @return fluent interface
+ */
public BeforeInvoke setLogging(boolean logging) {
this.log = logging;
return this;
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java
index 2d440f18b..db0a8cc8a 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java
@@ -108,11 +108,14 @@ public BeforeNew(InjectionPointData data) {
this.ordinal = data.getOrdinal();
String target = Strings.emptyToNull(data.get("class", data.get("target", "")).replace('.', '/'));
- MemberInfo member = MemberInfo.parseAndValidate(target, data.getMixin());
+ MemberInfo member = MemberInfo.parseAndValidate(target, data.getContext());
this.target = member.toCtorType();
this.desc = member.toCtorDesc();
}
+ /**
+ * Returns whether this injection point has a constructor descriptor defined
+ */
public boolean hasDescriptor() {
return this.desc != null;
}
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 7a3889e8f..22d677fef 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
@@ -261,6 +261,12 @@ public void postInject() {
}
}
+ /**
+ * Callback from injector which notifies us that a callback was injected. No
+ * longer used.
+ *
+ * @param target target into which the injector injected
+ */
public void notifyInjected(Target target) {
// this.targets.remove(target.method);
}
@@ -297,7 +303,7 @@ public MethodSlice getSlice(String id) {
* support use of a single slice will always return the default id (an empty
* string)
*
- * @param id
+ * @param id slice id
* @return mapped id
*/
public String getSliceId(String id) {
@@ -386,6 +392,15 @@ private void checkTarget(MethodNode target) {
}
}
+ /**
+ * Parse an injector from the specified method (if an injector annotation is
+ * present). If no injector annotation is present then null is
+ * returned.
+ *
+ * @param mixin context
+ * @param method mixin method
+ * @return parsed InjectionInfo or null
+ */
public static InjectionInfo parse(MixinTargetContext mixin, MethodNode method) {
AnnotationNode annotation = InjectionInfo.getInjectorAnnotation(mixin.getMixin(), method);
@@ -408,6 +423,15 @@ public static InjectionInfo parse(MixinTargetContext mixin, MethodNode method) {
return null;
}
+ /**
+ * Returns any injector annotation found on the specified method. If
+ * multiple matching annotations are found then an exception is thrown. If
+ * no annotations are present then null is returned.
+ *
+ * @param mixin context
+ * @param method mixin method
+ * @return annotation or null
+ */
@SuppressWarnings("unchecked")
public static AnnotationNode getInjectorAnnotation(IMixinInfo mixin, MethodNode method) {
AnnotationNode annotation = null;
@@ -426,6 +450,12 @@ public static AnnotationNode getInjectorAnnotation(IMixinInfo mixin, MethodNode
return annotation;
}
+ /**
+ * Get the conform prefix for an injector handler by type
+ *
+ * @param annotation Annotation to inspect
+ * @return conform prefix
+ */
public static String getInjectorPrefix(AnnotationNode annotation) {
if (annotation != null) {
if (annotation.desc.endsWith(ModifyArg.class.getSimpleName() + ";")) {
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.java b/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.java
index 01033993a..97fef302b 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.java
@@ -34,6 +34,7 @@
import org.spongepowered.asm.lib.tree.AnnotationNode;
import org.spongepowered.asm.lib.tree.MethodNode;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.InjectionPoint.Selector;
import org.spongepowered.asm.mixin.injection.modify.LocalVariableDiscriminator;
import org.spongepowered.asm.mixin.injection.throwables.InvalidInjectionPointException;
@@ -61,7 +62,7 @@ public class InjectionPointData {
/**
* Mixin
*/
- private final IMixinContext mixin;
+ private final IMixinContext context;
/**
* Injector callback
@@ -108,9 +109,9 @@ public class InjectionPointData {
*/
private final int opcode;
- public InjectionPointData(IMixinContext mixin, MethodNode method, AnnotationNode parent, String at, List args, String target,
+ public InjectionPointData(IMixinContext context, MethodNode method, AnnotationNode parent, String at, List args, String target,
String slice, int ordinal, int opcode) {
- this.mixin = mixin;
+ this.context = context;
this.method = method;
this.parent = parent;
this.at = at;
@@ -146,101 +147,165 @@ private void parseArgs(List args) {
}
}
+ /**
+ * Get the at value on the injector
+ */
public String getAt() {
return this.at;
}
+ /**
+ * Get the parsed constructor type for this injector
+ */
public String getType() {
return this.type;
}
+ /**
+ * Get the selector value parsed from the injector
+ */
public Selector getSelector() {
return this.selector;
}
- public IMixinContext getMixin() {
- return this.mixin;
+ /**
+ * Get the context
+ */
+ public IMixinContext getContext() {
+ return this.context;
}
+ /**
+ * Get the annotated method
+ */
public MethodNode getMethod() {
return this.method;
}
+ /**
+ * Get the return type of the annotated method
+ */
+ public Type getMethodReturnType() {
+ return Type.getReturnType(this.method.desc);
+ }
+
+ /**
+ * Get the root annotation (eg. {@link Inject})
+ */
public AnnotationNode getParent() {
return this.parent;
}
+ /**
+ * Get the slice id specified on the injector
+ */
public String getSlice() {
return this.slice;
}
- public Type getReturnType() {
- return Type.getReturnType(this.method.desc);
- }
-
public LocalVariableDiscriminator getLocalVariableDiscriminator() {
return LocalVariableDiscriminator.parse(this.parent);
}
+ /**
+ * Get the supplied value from the named args, return defaultValue if the
+ * arg is not set
+ *
+ * @param key argument name
+ * @param defaultValue value to return if the arg is not set
+ * @return argument value or default if not set
+ */
public String get(String key, String defaultValue) {
String value = this.args.get(key);
return value != null ? value : defaultValue;
}
+ /**
+ * Get the supplied value from the named args, return defaultValue if the
+ * arg is not set
+ *
+ * @param key argument name
+ * @param defaultValue value to return if the arg is not set
+ * @return argument value or default if not set
+ */
public int get(String key, int defaultValue) {
- return this.parseInt(this.get(key, String.valueOf(defaultValue)), defaultValue);
+ return InjectionPointData.parseInt(this.get(key, String.valueOf(defaultValue)), defaultValue);
}
+ /**
+ * Get the supplied value from the named args, return defaultValue if the
+ * arg is not set
+ *
+ * @param key argument name
+ * @param defaultValue value to return if the arg is not set
+ * @return argument value or default if not set
+ */
public boolean get(String key, boolean defaultValue) {
- return this.parseBoolean(this.get(key, String.valueOf(defaultValue)), defaultValue);
+ return InjectionPointData.parseBoolean(this.get(key, String.valueOf(defaultValue)), defaultValue);
}
+ /**
+ * Get the supplied value from the named args as a {@link MemberInfo},
+ * throws an exception if the argument cannot be parsed as a MemberInfo.
+ *
+ * @param key argument name
+ * @return argument value as a MemberInfo
+ */
public MemberInfo get(String key) {
try {
- return MemberInfo.parseAndValidate(this.get(key, ""), this.mixin);
+ return MemberInfo.parseAndValidate(this.get(key, ""), this.context);
} catch (InvalidMemberDescriptorException ex) {
- throw new InvalidInjectionPointException(this.mixin, "Failed parsing @At(\"%s\").%s descriptor \"%s\" on %s",
- this.at, key, this.target, InjectionInfo.describeInjector(this.mixin, this.parent, this.method));
- }
- }
-
- private int parseInt(String string, int defaultValue) {
- try {
- return Integer.parseInt(string);
- } catch (Exception ex) {
- return defaultValue;
- }
- }
-
- private boolean parseBoolean(String string, boolean defaultValue) {
- try {
- return Boolean.parseBoolean(string);
- } catch (Exception ex) {
- return defaultValue;
+ throw new InvalidInjectionPointException(this.context, "Failed parsing @At(\"%s\").%s descriptor \"%s\" on %s",
+ this.at, key, this.target, InjectionInfo.describeInjector(this.context, this.parent, this.method));
}
}
+ /**
+ * Get the target value specified on the injector
+ */
public MemberInfo getTarget() {
try {
- return MemberInfo.parseAndValidate(this.target, this.mixin);
+ return MemberInfo.parseAndValidate(this.target, this.context);
} catch (InvalidMemberDescriptorException ex) {
- throw new InvalidInjectionPointException(this.mixin, "Failed parsing @At(\"%s\") descriptor \"%s\" on %s",
- this.at, this.target, InjectionInfo.describeInjector(this.mixin, this.parent, this.method));
+ throw new InvalidInjectionPointException(this.context, "Failed parsing @At(\"%s\") descriptor \"%s\" on %s",
+ this.at, this.target, InjectionInfo.describeInjector(this.context, this.parent, this.method));
}
}
+ /**
+ * Get the ordinal specified on the injection point
+ */
public int getOrdinal() {
return this.ordinal;
}
+ /**
+ * Get the opcode specified on the injection point
+ */
public int getOpcode() {
return this.opcode;
}
+ /**
+ * Get the opcode specified on the injection point or return the default if
+ * no opcode was specified
+ *
+ * @param defaultOpcode opcode to return if none specified
+ * @return opcode or default
+ */
public int getOpcode(int defaultOpcode) {
return this.opcode > 0 ? this.opcode : defaultOpcode;
}
+ /**
+ * Get the opcode specified on the injection point or return the default if
+ * no opcode was specified or if the specified opcode does not appear in the
+ * supplied list of valid opcodes
+ *
+ * @param defaultOpcode opcode to return if none specified
+ * @param validOpcodes valid opcodes
+ * @return opcode or default
+ */
public int getOpcode(int defaultOpcode, int... validOpcodes) {
for (int validOpcode : validOpcodes) {
if (this.opcode == validOpcode) {
@@ -259,6 +324,17 @@ private static Pattern createPattern() {
return Pattern.compile(String.format("^([^:]+):?(%s)?$", Joiner.on('|').join(Selector.values())));
}
+ /**
+ * Parse a constructor type from the supplied at string
+ *
+ * @param at at to parse
+ * @return parsed constructor type
+ */
+ public static String parseType(String at) {
+ Matcher matcher = InjectionPointData.AT_PATTERN.matcher(at);
+ return InjectionPointData.parseType(matcher, at);
+ }
+
private static String parseType(Matcher matcher, String at) {
return matcher.matches() ? matcher.group(1) : at;
}
@@ -266,10 +342,21 @@ private static String parseType(Matcher matcher, String at) {
private static Selector parseSelector(Matcher matcher) {
return matcher.matches() && matcher.group(2) != null ? Selector.valueOf(matcher.group(2)) : Selector.DEFAULT;
}
-
- public static String parseType(String at) {
- Matcher matcher = InjectionPointData.AT_PATTERN.matcher(at);
- return InjectionPointData.parseType(matcher, at);
+
+ private static int parseInt(String string, int defaultValue) {
+ try {
+ return Integer.parseInt(string);
+ } catch (Exception ex) {
+ return defaultValue;
+ }
}
+ private static boolean parseBoolean(String string, boolean defaultValue) {
+ try {
+ return Boolean.parseBoolean(string);
+ } catch (Exception ex) {
+ return defaultValue;
+ }
+ }
+
}
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/struct/MemberInfo.java b/src/main/java/org/spongepowered/asm/mixin/injection/struct/MemberInfo.java
index ccb26b8e6..415322e54 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/struct/MemberInfo.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/struct/MemberInfo.java
@@ -282,6 +282,9 @@ public String toSrg() {
return this.owner + "/" + this.name;
}
+ /**
+ * Returns this MemberInfo as a java-style descriptor
+ */
public String toDescriptor() {
if (this.desc == null) {
return "";
@@ -290,6 +293,9 @@ public String toDescriptor() {
return new SignaturePrinter(this).setFullyQualified(true).toDescriptor();
}
+ /**
+ * Returns the constructor type represented by this MemberInfo
+ */
public String toCtorType() {
if (this.unparsed == null) {
return null;
@@ -311,6 +317,10 @@ public String toCtorType() {
return this.desc != null ? this.desc : this.unparsed;
}
+ /**
+ * Returns the constructor descriptor represented by this
+ * MemberInfo, returns null if no descriptor is present.
+ */
public String toCtorDesc() {
if (this.desc != null && this.desc.startsWith("(") && this.desc.indexOf(')') > -1) {
return this.desc.substring(0, this.desc.indexOf(')') + 1) + "V";
@@ -319,6 +329,11 @@ public String toCtorDesc() {
return null;
}
+ /**
+ * Get the return type for this MemberInfo, if the decriptor is present,
+ * returns null if the descriptor is absent or if this MemberInfo represents
+ * a field
+ */
public String getReturnType() {
if (this.desc == null || this.desc.indexOf(')') == -1 || this.desc.indexOf('(') != 0 ) {
return null;
@@ -331,10 +346,17 @@ public String getReturnType() {
return returnType;
}
+ /**
+ * Returns this MemberInfo as a {@link MappingField} or
+ * {@link MappingMethod}
+ */
public IMapping> asMapping() {
return this.isField() ? this.asFieldMapping() : this.asMethodMapping();
}
+ /**
+ * Returns this MemberInfo as a mapping method
+ */
public MappingMethod asMethodMapping() {
if (!this.isFullyQualified()) {
throw new MixinException("Cannot convert unqualified reference " + this + " to MethodMapping");
@@ -347,6 +369,9 @@ public MappingMethod asMethodMapping() {
return new MappingMethod(this.owner, this.name, this.desc);
}
+ /**
+ * Returns this MemberInfo as a mapping field
+ */
public MappingField asFieldMapping() {
if (!this.isField()) {
throw new MixinException("Cannot convert non-field reference " + this + " to FieldMapping");
@@ -620,12 +645,14 @@ private static MemberInfo parse(String input, ReferenceMapper refMapper, String
return new MemberInfo(name, owner, desc, matchAll, input);
}
+ /**
+ * Return the supplied mapping parsed as a MemberInfo
+ *
+ * @param mapping mapping to parse
+ * @return new MemberInfo
+ */
public static MemberInfo fromMapping(IMapping> mapping) {
return new MemberInfo(mapping);
}
-
- public static void main(String[] args) {
- MemberInfo m = MemberInfo.parseAndValidate(null); //"(Lfoo;III)Lfoo/bar/qcv;");
- System.err.printf(">> [%s] [%s]\n", m.toCtorType(), m.toCtorDesc());
- }
+
}
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.java b/src/main/java/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.java
index 36e52a5df..aa9b42efc 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.java
@@ -104,7 +104,7 @@ public boolean find(String desc, InsnList insns, Collection no
if (this.log) {
BeforeConstant.logger.info("BeforeConstant is searching for an constants in method with descriptor {}", desc);
- }
+ }
ListIterator iter = insns.iterator();
for (int ordinal = 0; iter.hasNext();) {
@@ -118,7 +118,7 @@ public boolean find(String desc, InsnList insns, Collection no
}
if (this.ordinal == -1 || this.ordinal == ordinal) {
if (this.log) {
- BeforeConstant.logger.info(" BeforeConstant found {}", ASMHelper.getNodeDescriptionForDebug(insn).trim());
+ BeforeConstant.logger.info(" BeforeConstant found {}", ASMHelper.describeNode(insn).trim());
}
nodes.add(insn);
found = true;
diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/struct/Target.java b/src/main/java/org/spongepowered/asm/mixin/injection/struct/Target.java
index d895ee2cb..645671394 100644
--- a/src/main/java/org/spongepowered/asm/mixin/injection/struct/Target.java
+++ b/src/main/java/org/spongepowered/asm/mixin/injection/struct/Target.java
@@ -41,6 +41,9 @@
*/
public class Target implements Comparable, Iterable {
+ /**
+ * Target class node
+ */
public final ClassNode classNode;
/**
@@ -177,8 +180,7 @@ public int allocateLocals(int locals) {
}
/**
- * Allocate a number of new stack variables for this method, returns the
- * first stack index of the allocated range
+ * Allocate a number of new local variables for this method
*
* @param locals number of locals to allocate
*/
@@ -186,16 +188,33 @@ public void addToLocals(int locals) {
this.setMaxLocals(this.maxLocals + locals);
}
+ /**
+ * Set the maxlocals for this target to the specified value, the specfied
+ * value must be higher than the original max locals
+ *
+ * @param maxLocals max locals value to set
+ */
public void setMaxLocals(int maxLocals) {
if (maxLocals > this.method.maxLocals) {
this.method.maxLocals = maxLocals;
}
}
+ /**
+ * Allocate a number of new stack variables for this method
+ *
+ * @param stack number of stack entries to allocate
+ */
public void addToStack(int stack) {
this.setMaxStack(this.maxStack + stack);
}
+ /**
+ * Set the max stack size for this target to the specified value, the
+ * specfied value must be higher than the original max stack
+ *
+ * @param maxStack max stack value to set
+ */
public void setMaxStack(int maxStack) {
if (maxStack > this.method.maxStack) {
this.method.maxStack = maxStack;
@@ -290,14 +309,29 @@ public int compareTo(Target o) {
return this.toString().compareTo(o.toString());
}
+ /**
+ * Return the index of the specified instruction in this instruction list
+ *
+ * @param insn instruction to locate, must exist in the target
+ * @return opcode index
+ */
public int indexOf(AbstractInsnNode insn) {
return this.insns.indexOf(insn);
}
+ /**
+ * Return the instruction at the specified index
+ *
+ * @param index opcode index
+ * @return requested instruction
+ */
public AbstractInsnNode get(int index) {
return this.insns.get(index);
}
+ /* (non-Javadoc)
+ * @see java.lang.Iterable#iterator()
+ */
@Override
public Iterator iterator() {
return this.insns.iterator();
@@ -337,6 +371,7 @@ public void replaceNode(AbstractInsnNode location, AbstractInsnNode champion, In
* @param location Instruction to replace
* @param champion Instruction which notionally replaces the original insn
* @param before Instructions to actually insert (must contain champion)
+ * @param after Instructions to insert after the specified location
*/
public void wrapNode(AbstractInsnNode location, AbstractInsnNode champion, InsnList before, InsnList after) {
this.insns.insertBefore(location, before);
diff --git a/src/main/java/org/spongepowered/asm/mixin/refmap/IMixinContext.java b/src/main/java/org/spongepowered/asm/mixin/refmap/IMixinContext.java
index 0021372d5..2ac9d58d4 100644
--- a/src/main/java/org/spongepowered/asm/mixin/refmap/IMixinContext.java
+++ b/src/main/java/org/spongepowered/asm/mixin/refmap/IMixinContext.java
@@ -53,10 +53,28 @@ public interface IMixinContext {
*/
public abstract ReferenceMapper getReferenceMapper();
+ /**
+ * Retrieve the value of the specified option from the environment
+ * this mixin belongs to.
+ *
+ * @param option option to check
+ * @return option value
+ */
public abstract boolean getOption(Option option);
+ /**
+ * Get the priority of the mixin
+ */
public abstract int getPriority();
- public abstract Target getTargetMethod(MethodNode into);
+ /**
+ * Obtain a {@link Target} method handle for a method in the target, this is
+ * used by consumers to manipulate the bytecode in a target method in a
+ * controlled manner.
+ *
+ * @param method method node to wrap
+ * @return target method
+ */
+ public abstract Target getTargetMethod(MethodNode method);
}
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/ClassInfo.java b/src/main/java/org/spongepowered/asm/mixin/transformer/ClassInfo.java
index 92a642491..22e48188f 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/ClassInfo.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/ClassInfo.java
@@ -63,7 +63,7 @@
* information needed to support more complex mixin behaviour such as detached
* superclass and mixin inheritance.
*/
-public class ClassInfo extends TreeInfo {
+public final class ClassInfo extends TreeInfo {
public static final int INCLUDE_PRIVATE = Opcodes.ACC_PRIVATE;
public static final int INCLUDE_STATIC = Opcodes.ACC_STATIC;
@@ -137,10 +137,16 @@ private Traversal(Traversal next, boolean traverse, SearchType searchType) {
this.searchType = searchType;
}
+ /**
+ * Return the next traversal type for this traversal type
+ */
public Traversal next() {
return this.next;
}
+ /**
+ * Return whether this traversal type allows traversal
+ */
public boolean canTraverse() {
return this.traverse;
}
@@ -158,10 +164,19 @@ public static class FrameData {
private static final String[] FRAMETYPES = { "NEW", "FULL", "APPEND", "CHOP", "SAME", "SAME1" };
+ /**
+ * Frame index
+ */
public final int index;
+ /**
+ * Frame type
+ */
public final int type;
+ /**
+ * Frame local count
+ */
public final int locals;
FrameData(int index, int type, int locals) {
@@ -338,7 +353,7 @@ public int getAccess() {
}
/**
- * @param name
+ * @param name new name
* @return the passed-in argument, for fluency
*/
public String renameTo(String name) {
@@ -964,7 +979,7 @@ private ClassInfo addMethodsRecursive(Set methods, boolean includeMixins
*
* @param superClass Name of the superclass to search for in the hierarchy
* @return true if the specified class appears in the class's hierarchy
- * anywhere
+ * anywhere
*/
public boolean hasSuperClass(String superClass) {
return this.hasSuperClass(superClass, Traversal.NONE);
@@ -976,7 +991,7 @@ public boolean hasSuperClass(String superClass) {
* @param superClass Name of the superclass to search for in the hierarchy
* @param traversal Traversal type to allow during this lookup
* @return true if the specified class appears in the class's hierarchy
- * anywhere
+ * anywhere
*/
public boolean hasSuperClass(String superClass, Traversal traversal) {
if (ClassInfo.JAVA_LANG_OBJECT.equals(superClass)) {
@@ -991,7 +1006,7 @@ public boolean hasSuperClass(String superClass, Traversal traversal) {
*
* @param superClass Superclass to search for in the hierarchy
* @return true if the specified class appears in the class's hierarchy
- * anywhere
+ * anywhere
*/
public boolean hasSuperClass(ClassInfo superClass) {
return this.hasSuperClass(superClass, Traversal.NONE);
@@ -1003,7 +1018,7 @@ public boolean hasSuperClass(ClassInfo superClass) {
* @param superClass Superclass to search for in the hierarchy
* @param traversal Traversal type to allow during this lookup
* @return true if the specified class appears in the class's hierarchy
- * anywhere
+ * anywhere
*/
public boolean hasSuperClass(ClassInfo superClass, Traversal traversal) {
if (ClassInfo.OBJECT == superClass) {
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/InterfaceInfo.java b/src/main/java/org/spongepowered/asm/mixin/transformer/InterfaceInfo.java
index 62e4746b8..b53a8e813 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/InterfaceInfo.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/InterfaceInfo.java
@@ -42,7 +42,7 @@
* Information about an interface being runtime-patched onto a mixin target
* class, see {@link org.spongepowered.asm.mixin.Implements Implements}
*/
-public class InterfaceInfo extends TreeInfo {
+public final class InterfaceInfo extends TreeInfo {
/**
* Parent mixin
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MemberRef.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MemberRef.java
index 111a0f769..79475c4c6 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MemberRef.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MemberRef.java
@@ -31,11 +31,10 @@
import org.spongepowered.asm.util.ASMHelper;
/**
- * Reference to a field or method that also includes invocation
- * instructions.
+ * Reference to a field or method that also includes invocation instructions.
*
- * To instances are defined to be equal if they both refer to the same method
- * and have the same invocation instructions.
+ * To instances are defined to be equal if they both refer to the same method
+ * and have the same invocation instructions.
*/
public abstract class MemberRef {
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MethodMapper.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MethodMapper.java
index d77290344..da119d6dd 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MethodMapper.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MethodMapper.java
@@ -74,6 +74,13 @@ public ClassInfo getClassInfo() {
return this.info;
}
+ /**
+ * Conforms an injector handler method
+ *
+ * @param mixin owner mixin
+ * @param handler annotated injector handler method
+ * @param method method in target
+ */
public void remapHandlerMethod(MixinInfo mixin, MethodNode handler, Method method) {
if (!(handler instanceof MixinMethodNode) || !((MixinMethodNode)handler).isInjector()) {
return;
@@ -92,6 +99,12 @@ public void remapHandlerMethod(MixinInfo mixin, MethodNode handler, Method metho
handler.name = method.renameTo(handlerName);
}
+ /**
+ * Get the name for a handler method provided a source mixin method
+ *
+ * @param method mixin method
+ * @return conformed handler name
+ */
public String getHandlerName(MixinMethodNode method) {
String prefix = InjectionInfo.getInjectorPrefix(method.getInjectorAnnotation());
String classUID = MethodMapper.getClassUID(method.getOwner().getClassRef());
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.java
index 16ea3e3ce..84a7b5886 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.java
@@ -310,7 +310,7 @@ protected void applySignature(MixinTargetContext mixin) {
/**
* Mixin interfaces implemented by the mixin class onto the target class
*
- * @param mixin
+ * @param mixin mixin target context
*/
protected void applyInterfaces(MixinTargetContext mixin) {
for (String interfaceName : mixin.getInterfaces()) {
@@ -324,7 +324,7 @@ protected void applyInterfaces(MixinTargetContext mixin) {
/**
* Mixin misc attributes from mixin class onto the target class
*
- * @param mixin
+ * @param mixin mixin target context
*/
protected void applyAttributes(MixinTargetContext mixin) {
if (mixin.shouldSetSourceFile()) {
@@ -336,7 +336,7 @@ protected void applyAttributes(MixinTargetContext mixin) {
/**
* Mixin class-level annotations on the mixin into the target class
*
- * @param mixin
+ * @param mixin mixin target context
*/
protected void applyAnnotations(MixinTargetContext mixin) {
ClassNode sourceClass = mixin.getClassNode();
@@ -349,7 +349,7 @@ protected void applyAnnotations(MixinTargetContext mixin) {
* fields so that transformMethod can rename field references in the method
* body.
*
- * @param mixin
+ * @param mixin mixin target context
*/
protected void applyFields(MixinTargetContext mixin) {
this.mergeShadowFields(mixin);
@@ -384,7 +384,7 @@ protected void mergeNewFields(MixinTargetContext mixin) {
/**
* Mixin methods from the mixin class into the target class
*
- * @param mixin
+ * @param mixin mixin target context
*/
protected void applyMethods(MixinTargetContext mixin) {
for (MethodNode shadow : mixin.getShadowMethods()) {
@@ -413,7 +413,7 @@ protected void applyNormalMethod(MixinTargetContext mixin, MethodNode mixinMetho
this.mergeMethod(mixin, mixinMethod);
} else if (Constants.CLINIT.equals(mixinMethod.name)) {
// Class initialiser insns get appended
- this.appendInsns(mixinMethod);
+ this.appendInsns(mixin, mixinMethod);
}
}
@@ -576,9 +576,10 @@ protected void displaceIntrinsic(MixinTargetContext mixin, MethodNode method, Me
* Handles appending instructions from the source method to the target
* method. Both methods must return void
*
- * @param method
+ * @param mixin mixin target context
+ * @param method source method
*/
- protected final void appendInsns(MethodNode method) {
+ protected final void appendInsns(MixinTargetContext mixin, MethodNode method) {
if (Type.getReturnType(method.desc) != Type.VOID_TYPE) {
throw new IllegalArgumentException("Attempted to merge insns from a method which does not return void");
}
@@ -611,7 +612,7 @@ protected final void appendInsns(MethodNode method) {
* (Attempts to) find and patch field initialisers from the mixin into the
* target class
*
- * @param mixin
+ * @param mixin mixin target context
*/
protected void applyInitialisers(MixinTargetContext mixin) {
// Try to find a suitable constructor, we need a constructor with line numbers in order to extract the initialiser
@@ -662,7 +663,7 @@ protected MethodNode getConstructor(MixinTargetContext mixin) {
* Identifies line numbers in the supplied ctor which correspond to the
* start and end of the method body.
*
- * @param ctor
+ * @param ctor constructor to scan
* @return range indicating the line numbers of the specified constructor
* and the position of the superclass ctor invocation
*/
@@ -706,14 +707,16 @@ private Range getConstructorRange(MethodNode ctor) {
* Get insns corresponding to the instance initialiser (hopefully) from the
* supplied constructor.
*
- * TODO Potentially rewrite this to be less horrible.
- *
- * @param mixin
- * @param ctor
+ * @param mixin mixin target context
+ * @param ctor constructor to inspect
* @return initialiser bytecode extracted from the supplied constructor, or
* null if the constructor range could not be parsed
*/
protected final Deque getInitialiser(MixinTargetContext mixin, MethodNode ctor) {
+ //
+ // TODO Potentially rewrite this to be less horrible.
+ //
+
// Find the range of line numbers which corresponds to the constructor body
Range init = this.getConstructorRange(ctor);
if (!init.isValid()) {
@@ -781,8 +784,9 @@ protected final Deque getInitialiser(MixinTargetContext mixin,
/**
* Inject initialiser code into the target constructor
*
- * @param ctor
- * @param initialiser
+ * @param mixin mixin target context
+ * @param ctor target constructor
+ * @param initialiser initialiser instructions
*/
protected final void injectInitialiser(MixinTargetContext mixin, MethodNode ctor, Deque initialiser) {
Map labels = ASMHelper.cloneLabels(ctor.instructions);
@@ -901,8 +905,8 @@ protected void applyAccessors(MixinTargetContext mixin) {
/**
* Check visibility before merging a mixin method
*
- * @param mixin
- * @param mixinMethod
+ * @param mixin mixin target context
+ * @param mixinMethod method to check
*/
protected void checkMethodVisibility(MixinTargetContext mixin, MethodNode mixinMethod) {
if (ASMHelper.hasFlag(mixinMethod, Opcodes.ACC_STATIC)
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinConfig.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinConfig.java
index dff633424..901d63a06 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinConfig.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinConfig.java
@@ -62,7 +62,7 @@
/**
* Mixin configuration bundle
*/
-class MixinConfig implements Comparable, IMixinConfig {
+final class MixinConfig implements Comparable, IMixinConfig {
/**
* Wrapper for injection options
@@ -738,7 +738,7 @@ public boolean packageMatch(String className) {
* Check whether this configuration bundle has a mixin for the specified
* class
*
- * @param targetClass
+ * @param targetClass target class
* @return true if this bundle contains any mixins for the specified target
*/
public boolean hasMixinsFor(String targetClass) {
@@ -748,7 +748,7 @@ public boolean hasMixinsFor(String targetClass) {
/**
* Get mixins for the specified target class
*
- * @param targetClass
+ * @param targetClass target class
* @return mixins for the specified target
*/
public List getMixinsFor(String targetClass) {
@@ -805,7 +805,7 @@ public int compareTo(MixinConfig other) {
* Factory method, creates a new mixin configuration bundle from the
* specified configFile, which must be accessible on the classpath
*
- * @param configFile
+ * @param configFile configuration file to load
* @param outer fallback environment
* @return new Config
*/
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 b0f1aa0cb..87d687fc2 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java
@@ -479,7 +479,8 @@ boolean isDetachedSuper() {
/**
* True if this mixin class can actually be classloaded
*
- * @return
+ * @return whether this subtype is directly classloadable (supports
+ * classloader pinholing)
*/
boolean isLoadable() {
return false;
@@ -488,8 +489,8 @@ boolean isLoadable() {
/**
* Validate a single target before adding
*
- * @param targetName
- * @param targetInfo
+ * @param targetName target class name
+ * @param targetInfo information about the target class
*/
void validateTarget(String targetName, ClassInfo targetInfo) {
boolean targetIsInterface = targetInfo.isInterface();
@@ -740,11 +741,13 @@ static SubType getTypeFor(MixinInfo mixin) {
/**
* Internal ctor, called by {@link MixinConfig}
*
- * @param parent
- * @param mixinName
- * @param runTransformers
- * @param plugin
- * @param suppressPlugin
+ * @param parent configuration which owns this mixin, the parent
+ * @param mixinName name of this mixin (class name stub)
+ * @param runTransformers true if this mixin should run transformers on its
+ * bytecode when loading
+ * @param plugin mixin config companion plugin, may be null
+ * @param suppressPlugin true to suppress the plugin from filtering targets
+ * of this mixin
*/
MixinInfo(MixinConfig parent, String mixinName, boolean runTransformers, IMixinConfigPlugin plugin, boolean suppressPlugin) {
this.parent = parent;
@@ -805,8 +808,8 @@ void validate() {
/**
* Read the target class names from the {@link Mixin} annotation
*
- * @param classNode
- * @param suppressPlugin
+ * @param classNode mixin classnode
+ * @param suppressPlugin true to suppress plugin filtering targets
* @return target class list read from classNode
*/
protected List readTargetClasses(MixinClassNode classNode, boolean suppressPlugin) {
@@ -896,7 +899,7 @@ private void handleTargetError(String message) {
/**
* Read the priority from the {@link Mixin} annotation
*
- * @param classNode
+ * @param classNode mixin classnode
* @return priority read from classNode
*/
protected int readPriority(ClassNode classNode) {
@@ -1092,7 +1095,7 @@ Set getInterfaces() {
/**
* Get a new mixin target context object for the specified target
*
- * @param target
+ * @param target target class context
* @return new context
*/
MixinTargetContext createContextFor(TargetClassContext target) {
@@ -1101,10 +1104,12 @@ MixinTargetContext createContextFor(TargetClassContext target) {
}
/**
- * @param mixinClassName
- * @param runTransformers
- * @return
- * @throws ClassNotFoundException
+ * Load the mixin class bytes
+ *
+ * @param mixinClassName mixin class name
+ * @param runTransformers true to run transformers on the loaded bytecode
+ * @return mixin bytecode
+ * @throws ClassNotFoundException if the mixin bytes could not be found
*/
private byte[] loadMixinClass(String mixinClassName, boolean runTransformers) throws ClassNotFoundException {
byte[] mixinBytes = null;
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 6c5335be7..d0aa05a51 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java
@@ -188,7 +188,7 @@ MixinTargetContext createContextFor(TargetClassContext target) {
/**
* Run the second pass, attach to the specified context
*
- * @param context
+ * @param context mixin target context
*/
MixinPreProcessorStandard attach(MixinTargetContext context) {
if (this.attached) {
@@ -474,8 +474,8 @@ protected void attachFields(MixinTargetContext context) {
boolean isFinal = field.isDecoratedFinal();
if (this.verboseLogging && ASMHelper.hasFlag(target, Opcodes.ACC_FINAL) != isFinal) {
String message = isFinal
- ? "@Shadow field {}::{} is decorated with @Final but target is not final"
- : "@Shadow target {}::{} is final but shadow is not decorated with @Final";
+ ? "@Shadow field {}::{} is decorated with @Final but target is not final"
+ : "@Shadow target {}::{} is final but shadow is not decorated with @Final";
MixinPreProcessorStandard.logger.warn(message, this.mixin, mixinField.name);
}
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTargetContext.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTargetContext.java
index 32bf23029..b7e514fd8 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTargetContext.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTargetContext.java
@@ -180,21 +180,29 @@ public class MixinTargetContext implements IMixinContext {
}
/**
- * @param method
+ * Add a shadow method to this mixin context, called by the preprocessor
+ *
+ * @param method shadow method to add
*/
void addShadowMethod(MethodNode method) {
this.shadowMethods.add(method);
}
/**
- * @param fieldNode
+ * Add a shadow field to this mixin context, called by the preprocessor
+ *
+ * @param fieldNode field node
+ * @param fieldInfo field info
*/
void addShadowField(FieldNode fieldNode, Field fieldInfo) {
this.shadowFields.put(fieldNode, fieldInfo);
}
/**
- * @param method
+ * Add an accessor method to this mixin context, called by the preprocessor
+ *
+ * @param method method to add
+ * @param type annotation type
*/
void addAccessorMethod(MethodNode method, Class extends Annotation> type) {
this.accessors.add(AccessorInfo.of(this, method, type));
@@ -203,7 +211,7 @@ void addAccessorMethod(MethodNode method, Class extends Annotation> type) {
/**
* Callback from the applicator which notifies us that a method was merged
*
- * @param method
+ * @param method merged method
*/
void addMergedMethod(MethodNode method) {
this.mergedMethods.add(method);
@@ -1032,10 +1040,26 @@ public void postApply(String transformedName, ClassNode targetClass) {
this.mixin.postApply(transformedName, targetClass);
}
+ /**
+ * Obtain a unique name for the specified method from the target class
+ * context
+ *
+ * @param method method to obtain a name for
+ * @param preservePrefix true to preserve the method prefix (decorate as
+ * postfix) otherwise decorates as infix
+ * @return unique method name
+ */
public String getUniqueName(MethodNode method, boolean preservePrefix) {
return this.targetClass.getUniqueName(method, preservePrefix);
}
+ /**
+ * Obtain a unique name for the specified field from the target class
+ * context
+ *
+ * @param field field to obtain a name for
+ * @return unique field name
+ */
public String getUniqueName(FieldNode field) {
return this.targetClass.getUniqueName(field);
}
@@ -1077,6 +1101,10 @@ public void applyInjections() {
this.injectors.clear();
}
+ /**
+ * Expand accessor methods mixed into the target class by populating the
+ * method bodies
+ */
public List generateAccessors() {
for (AccessorInfo accessor : this.accessors) {
accessor.locate();
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTransformer.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTransformer.java
index 18929e302..bcca2d131 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTransformer.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinTransformer.java
@@ -333,8 +333,7 @@ private IDecompiler initDecompiler(File outputPath) {
MixinTransformer.logger.info("Attempting to load Fernflower decompiler{}", as ? " (Threaded mode)" : "");
String className = "org.spongepowered.asm.mixin.transformer.debug.RuntimeDecompiler" + (as ? "Async" : "");
@SuppressWarnings("unchecked")
- Class extends IDecompiler> clazz =
- (Class extends IDecompiler>)Class.forName(className);
+ Class extends IDecompiler> clazz = (Class extends IDecompiler>)Class.forName(className);
Constructor extends IDecompiler> ctor = clazz.getDeclaredConstructor(File.class);
IDecompiler decompiler = ctor.newInstance(outputPath);
MixinTransformer.logger.info("Fernflower decompiler was successfully initialised, exported classes will be decompiled{}",
@@ -779,7 +778,7 @@ public void onInit(MixinInfo mixin) {
* Apply mixins for specified target class to the class described by the
* supplied byte array.
*
- * @param context
+ * @param context target class context
* @return class bytecode after application of mixins
*/
private byte[] applyMixins(TargetClassContext context) {
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/TargetClassContext.java b/src/main/java/org/spongepowered/asm/mixin/transformer/TargetClassContext.java
index ea11fb0eb..294aa732b 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/TargetClassContext.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/TargetClassContext.java
@@ -218,8 +218,8 @@ MethodNode findAliasedMethod(Deque aliases, String desc) {
/**
* Finds a field in the target class
*
- * @param aliases
- * @param desc
+ * @param aliases aliases for the field
+ * @param desc field descriptor
* @return Target field or null if not found
*/
FieldNode findAliasedField(Deque aliases, String desc) {
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/TreeInfo.java b/src/main/java/org/spongepowered/asm/mixin/transformer/TreeInfo.java
index 91a8b032f..0cc92f716 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/TreeInfo.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/TreeInfo.java
@@ -104,7 +104,7 @@ protected static byte[] loadClass(String className, boolean runTransformers) thr
* @param name Original class name
* @param transformedName Name of the class to load
* @return raw class bytecode
- * @throws IOException
+ * @throws IOException if an error occurs reading the class bytes
*/
private static byte[] getClassBytes(String name, String transformedName) throws IOException {
byte[] classBytes = Launch.classLoader.getClassBytes(name);
@@ -130,9 +130,9 @@ private static byte[] getClassBytes(String name, String transformedName) throws
* Since we obtain the class bytes with getClassBytes(), we need to apply
* the transformers ourself
*
- * @param name
- * @param transformedName
- * @param basicClass
+ * @param name class name
+ * @param transformedName transformed class name
+ * @param basicClass input class bytes
* @return class bytecode after processing by all registered transformers
* except the excluded transformers
*/
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/debug/IHotSwap.java b/src/main/java/org/spongepowered/asm/mixin/transformer/debug/IHotSwap.java
index cca77c9af..ecfbe0dd7 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/debug/IHotSwap.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/debug/IHotSwap.java
@@ -32,7 +32,7 @@ public interface IHotSwap {
/**
* Registers a mixin class with the agent.
*
- * This is needed as the mixin needs to be loaded to be redefined.
+ * This is needed as the mixin needs to be loaded to be redefined.
*
* @param name Fully qualified name of the mixin class
*/
@@ -41,8 +41,8 @@ public interface IHotSwap {
/**
* Registers a class targeted by at least one mixin.
*
- * This is used to rollback the target class to a state before the mixin's
- * where applied.
+ * This is used to rollback the target class to a state before the
+ * mixin's were applied.
*
* @param name Name of the class
* @param bytecode Bytecode of the class before mixin's have been applied
diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/meta/SourceMap.java b/src/main/java/org/spongepowered/asm/mixin/transformer/meta/SourceMap.java
index f3b0e8a4b..2dc4ee2b4 100644
--- a/src/main/java/org/spongepowered/asm/mixin/transformer/meta/SourceMap.java
+++ b/src/main/java/org/spongepowered/asm/mixin/transformer/meta/SourceMap.java
@@ -135,6 +135,11 @@ void appendFile(StringBuilder sb) {
}
}
+ /**
+ * Append lines representing this File to the supplied StringBuilder
+ *
+ * @param sb StringBuilder to append to
+ */
public void appendLines(StringBuilder sb) {
sb.append("1#").append(this.id) // Map line number 1 (onwards) in file number
.append(",").append(this.size) // repeated times (eg. lines 1 to )
@@ -217,18 +222,48 @@ public String getPseudoGeneratedSourceFile() {
return this.sourceFile.replace(".java", "$mixin.java");
}
+ /**
+ * Add a file to this SourceMap in the default stratum
+ *
+ * @param classNode class node to read details from
+ * @return new File
+ */
public File addFile(ClassNode classNode) {
return this.addFile(this.defaultStratum, classNode);
}
+ /**
+ * Add a file to this SourceMap in the specified stratum
+ *
+ * @param stratumName name of the stratum to add to
+ * @param classNode class node to read file details from
+ * @return new File
+ */
public File addFile(String stratumName, ClassNode classNode) {
return this.addFile(stratumName, classNode.sourceFile, classNode.name + ".java", ASMHelper.getMaxLineNumber(classNode, 500, 50));
}
- public File addFile( String sourceFileName, String sourceFilePath, int size) {
+ /**
+ * Add a file to this SourceMap in the default stratum
+ *
+ * @param sourceFileName source filename
+ * @param sourceFilePath path to source file
+ * @param size number of lines to allocate
+ * @return new File
+ */
+ public File addFile(String sourceFileName, String sourceFilePath, int size) {
return this.addFile(this.defaultStratum, sourceFileName, sourceFilePath, size);
}
+ /**
+ * Add a file to this SourceMap in the specified stratum
+ *
+ * @param stratumName name of the stratum to add to
+ * @param sourceFileName source filename
+ * @param sourceFilePath path to source file
+ * @param size number of lines to allocate
+ * @return new File
+ */
public File addFile(String stratumName, String sourceFileName, String sourceFilePath, int size) {
Stratum stratum = this.strata.get(stratumName);
if (stratum == null) {
diff --git a/src/main/java/org/spongepowered/asm/obfuscation/RemapperChain.java b/src/main/java/org/spongepowered/asm/obfuscation/RemapperChain.java
index 926c0358e..c6822240e 100644
--- a/src/main/java/org/spongepowered/asm/obfuscation/RemapperChain.java
+++ b/src/main/java/org/spongepowered/asm/obfuscation/RemapperChain.java
@@ -42,6 +42,12 @@ public String toString() {
return String.format("RemapperChain[%d]", this.remappers.size());
}
+ /**
+ * Add a new remapper to this chain
+ *
+ * @param remapper remapper to add
+ * @return fluent interface
+ */
public RemapperChain add(IRemapper remapper) {
this.remappers.add(remapper);
return this;
diff --git a/src/main/java/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.java b/src/main/java/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.java
index 75e8c9df3..3b2597dc7 100644
--- a/src/main/java/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.java
+++ b/src/main/java/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.java
@@ -95,6 +95,13 @@ public MappingMethod copy() {
return new MappingMethod(this.getOwner(), this.getSimpleName(), this.getDesc());
}
+ /**
+ * Return a clone of this mapping with the supplied prefix added. Returns
+ * this object if the prefix matches the existing name.
+ *
+ * @param prefix prefix to prepend
+ * @return cloned mapping
+ */
public MappingMethod addPrefix(String prefix) {
String simpleName = this.getSimpleName();
if (simpleName == null || simpleName.startsWith(prefix)) {
diff --git a/src/main/java/org/spongepowered/asm/util/ASMHelper.java b/src/main/java/org/spongepowered/asm/util/ASMHelper.java
index 484ef163f..6aa3643ff 100644
--- a/src/main/java/org/spongepowered/asm/util/ASMHelper.java
+++ b/src/main/java/org/spongepowered/asm/util/ASMHelper.java
@@ -50,24 +50,39 @@
/**
* Utility methods for working with ASM
*/
-public class ASMHelper {
+public final class ASMHelper {
+ /**
+ * Integer constant opcodes
+ */
public static final int[] CONSTANTS_INT = {
Opcodes.ICONST_M1, Opcodes.ICONST_0, Opcodes.ICONST_1, Opcodes.ICONST_2, Opcodes.ICONST_3, Opcodes.ICONST_4, Opcodes.ICONST_5
};
+ /**
+ * Float constant opcodes
+ */
public static final int[] CONSTANTS_FLOAT = {
Opcodes.FCONST_0, Opcodes.FCONST_1, Opcodes.FCONST_2
};
+ /**
+ * Double constant opcodes
+ */
public static final int[] CONSTANTS_DOUBLE = {
Opcodes.DCONST_0, Opcodes.DCONST_1
};
+ /**
+ * Long constant opcodes
+ */
public static final int[] CONSTANTS_LONG = {
Opcodes.LCONST_0, Opcodes.LCONST_1
};
+ /**
+ * All constant opcodes
+ */
public static final int[] CONSTANTS_ALL = {
Opcodes.ACONST_NULL,
Opcodes.ICONST_M1,
@@ -90,15 +105,19 @@ public class ASMHelper {
};
private static final String[] CONSTANTS_TYPES = {
- null,
- "I",
- "I", "I", "I", "I", "I", "I",
- "J", "J",
- "F", "F", "F",
- "D", "D",
- "I", //"B",
- "I", //"S"
+ null,
+ "I",
+ "I", "I", "I", "I", "I", "I",
+ "J", "J",
+ "F", "F", "F",
+ "D", "D",
+ "I", //"B",
+ "I", //"S"
};
+
+ private ASMHelper() {
+ // utility class
+ }
/**
* Finds a method given the method descriptor
@@ -173,7 +192,7 @@ public static void printMethodWithOpcodeIndices(MethodNode method) {
System.err.printf("%s%s\n", method.name, method.desc);
int i = 0;
for (Iterator iter = method.instructions.iterator(); iter.hasNext();) {
- System.err.printf("[%4d] %s\n", i++, ASMHelper.getNodeDescriptionForDebug(iter.next()));
+ System.err.printf("[%4d] %s\n", i++, ASMHelper.describeNode(iter.next()));
}
}
@@ -196,10 +215,20 @@ public static void printMethod(MethodNode method) {
* @param node Node to print
*/
public static void printNode(AbstractInsnNode node) {
- System.err.printf("%s\n", ASMHelper.getNodeDescriptionForDebug(node));
+ System.err.printf("%s\n", ASMHelper.describeNode(node));
}
- public static String getNodeDescriptionForDebug(AbstractInsnNode node) {
+ /**
+ * Gets a description of the supplied node for debugging purposes
+ *
+ * @param node node to describe
+ * @return human-readable description of node
+ */
+ public static String describeNode(AbstractInsnNode node) {
+ if (node == null) {
+ return String.format(" %-14s ", "null");
+ }
+
if (node instanceof LabelNode) {
return String.format("[%s]", ((LabelNode)node).getLabel());
}
@@ -645,10 +674,22 @@ public static > T getAnnotationValue(AnnotationNode annotation
return Enum.valueOf(enumClass, value[1]);
}
+ /**
+ * Returns true if the supplied method node is static
+ *
+ * @param method method node
+ * @return true if the method has the {@link Opcodes#ACC_STATIC} flag
+ */
public static boolean methodIsStatic(MethodNode method) {
return (method.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC;
}
+ /**
+ * Returns true if the supplied field node is static
+ *
+ * @param field field node
+ * @return true if the field has the {@link Opcodes#ACC_STATIC} flag
+ */
public static boolean fieldIsStatic(FieldNode field) {
return (field.access & Opcodes.ACC_STATIC) == Opcodes.ACC_STATIC;
}
@@ -733,6 +774,14 @@ public static void loadArgs(Type[] args, InsnList insns, int start, int end) {
}
}
+ /**
+ * Clones all of the labels in the source instruction list and returns the
+ * clones in a map of old label -> new label. This is used to facilitate
+ * the use of {@link AbstractInsnNode#clone}.
+ *
+ * @param source instruction list
+ * @return map of existing labels to their cloned counterparts
+ */
public static Map cloneLabels(InsnList source) {
Map labels = new HashMap();
@@ -747,8 +796,13 @@ public static Map cloneLabels(InsnList source) {
}
/**
- * @param returnType
- * @param args
+ * Generate a bytecode descriptor from the supplied tokens. Each token can
+ * be a {@link Type}, a {@link Class} or otherwise is converted in-place by
+ * calling {@link Object#toString toString}.
+ *
+ * @param returnType object representing the method return type, can be
+ * null for void
+ * @param args objects representing argument types
*/
public static String generateDescriptor(Object returnType, Object... args) {
StringBuilder sb = new StringBuilder().append('(');
@@ -761,7 +815,10 @@ public static String generateDescriptor(Object returnType, Object... args) {
}
/**
- * @param arg
+ * Converts the supplied object to a descriptor component, used by
+ * {@link #generateDescriptor}.
+ *
+ * @param arg object to convert
*/
private static String toDescriptor(Object arg) {
if (arg instanceof String) {
@@ -774,18 +831,46 @@ private static String toDescriptor(Object arg) {
return arg == null ? "" : arg.toString();
}
+ /**
+ * Returns the simple name of an annotation, mainly used for printing
+ * annotation names in error messages/user-facing strings
+ *
+ * @param annotationType annotation
+ * @return annotation's simple name
+ */
public static String getSimpleName(Class extends Annotation> annotationType) {
return annotationType.getSimpleName();
}
+ /**
+ * Returns the simple name of an annotation, mainly used for printing
+ * annotation names in error messages/user-facing strings
+ *
+ * @param annotation annotation node
+ * @return annotation's simple name
+ */
public static String getSimpleName(AnnotationNode annotation) {
return ASMHelper.getSimpleName(annotation.desc);
}
+ /**
+ * Returns the simple name from an object type descriptor (in L...; format)
+ *
+ * @param desc type descriptor
+ * @return "simple" name
+ */
public static String getSimpleName(String desc) {
- return desc.substring(desc.lastIndexOf('/') + 1).replace(";", "");
+ int pos = Math.max(desc.lastIndexOf('/'), 0);
+ return desc.substring(pos + 1).replace(";", "");
}
+ /**
+ * Gets whether the supplied instruction is a constant instruction (eg.
+ * ICONST_1)
+ *
+ * @param insn instruction to check
+ * @return true if the supplied instruction is a constant
+ */
public static boolean isConstant(AbstractInsnNode insn) {
if (insn == null) {
return false;
@@ -793,6 +878,14 @@ public static boolean isConstant(AbstractInsnNode insn) {
return Ints.contains(ASMHelper.CONSTANTS_ALL, insn.getOpcode());
}
+ /**
+ * If the supplied instruction is a constant, returns the constant value
+ * from the instruction
+ *
+ * @param insn constant instruction to process
+ * @return the constant value or null if the value cannot be parsed
+ * (or is null)
+ */
public static Object getConstant(AbstractInsnNode insn) {
if (insn == null) {
return null;
@@ -810,6 +903,13 @@ public static Object getConstant(AbstractInsnNode insn) {
return index < 0 ? null : ASMHelper.CONSTANTS_VALUES[index];
}
+ /**
+ * Returns the {@link Type} of a particular constant instruction's payload
+ *
+ * @param insn constant instruction
+ * @return type of constant or null if it cannot be parsed (or is
+ * null)
+ */
public static Type getConstantType(AbstractInsnNode insn) {
if (insn == null) {
return null;
@@ -838,8 +938,8 @@ public static Type getConstantType(AbstractInsnNode insn) {
/**
* Check whether the specified flag is set on the specified class
*
- * @param classNode
- * @param flag
+ * @param classNode class node
+ * @param flag flag to check
* @return True if the specified flag is set in this method's access flags
*/
public static boolean hasFlag(ClassNode classNode, int flag) {
@@ -849,8 +949,8 @@ public static boolean hasFlag(ClassNode classNode, int flag) {
/**
* Check whether the specified flag is set on the specified method
*
- * @param method
- * @param flag
+ * @param method method node
+ * @param flag flag to check
* @return True if the specified flag is set in this method's access flags
*/
public static boolean hasFlag(MethodNode method, int flag) {
@@ -860,8 +960,8 @@ public static boolean hasFlag(MethodNode method, int flag) {
/**
* Check whether the specified flag is set on the specified field
*
- * @param field
- * @param flag
+ * @param field field node
+ * @param flag flag to check
* @return True if the specified flag is set in this field's access flags
*/
public static boolean hasFlag(FieldNode field, int flag) {
diff --git a/src/main/java/org/spongepowered/asm/util/ClassSignature.java b/src/main/java/org/spongepowered/asm/util/ClassSignature.java
index 8abf5a3bd..8afdc819e 100644
--- a/src/main/java/org/spongepowered/asm/util/ClassSignature.java
+++ b/src/main/java/org/spongepowered/asm/util/ClassSignature.java
@@ -1265,7 +1265,7 @@ public SignatureVisitor getRemapper() {
@Override
public String toString() {
while (this.rawInterfaces.size() > 0) {
- this.addRawInterface(this.rawInterfaces.remove());
+ this.addRawInterface(this.rawInterfaces.remove());
}
StringBuilder sb = new StringBuilder();
diff --git a/src/main/java/org/spongepowered/asm/util/ConstraintParser.java b/src/main/java/org/spongepowered/asm/util/ConstraintParser.java
index 4ef7af17d..92363fcc3 100644
--- a/src/main/java/org/spongepowered/asm/util/ConstraintParser.java
+++ b/src/main/java/org/spongepowered/asm/util/ConstraintParser.java
@@ -72,9 +72,9 @@ public final class ConstraintParser {
* Greater than or equal to 1234 (equivalent to 1234
* >
)
* (1234-1300)
- * Value must be between 1234 and 1300 (inclusive)
+ * Value must be between 1234 and 1300 (inclusive)
* (1234+10)
- * Value must be between 1234 and 1234+10 (1234-1244
+ * Value must be between 1234 and 1234+10 (1234-1244
* inclusive)
*
*
@@ -220,6 +220,13 @@ public int getMax() {
return this.max;
}
+ /**
+ * Checks the current token against the environment and throws a
+ * {@link ConstraintViolationException} if the constraint is invalid
+ *
+ * @param environment environment to fetch constraints
+ * @throws ConstraintViolationException if constraint is not valid
+ */
public void check(ITokenProvider environment) throws ConstraintViolationException {
if (this != Constraint.NONE) {
Integer value = environment.getToken(this.token);
@@ -240,6 +247,10 @@ public void check(ITokenProvider environment) throws ConstraintViolationExceptio
}
}
+ /**
+ * Gets a human-readable description of the range expressed by this
+ * constraint
+ */
public String getRangeHumanReadable() {
if (this.min == Integer.MIN_VALUE && this.max == Integer.MAX_VALUE) {
return "ANY VALUE";
@@ -262,6 +273,14 @@ public String toString() {
private ConstraintParser() {
}
+ /**
+ * Parse the supplied expression as a constraint and returns a new
+ * Constraint. Returns {@link Constraint#NONE} if the constraint could not
+ * be parsed or is empty.
+ *
+ * @param expr constraint expression to parse
+ * @return parsed constraint
+ */
public static Constraint parse(String expr) {
if (expr == null || expr.length() == 0) {
return Constraint.NONE;
@@ -281,6 +300,15 @@ public static Constraint parse(String expr) {
return head != null ? head : Constraint.NONE;
}
+ /**
+ * Parse a constraint expression on the supplied annotation as a constraint
+ * and returns a new Constraint. Returns {@link Constraint#NONE} if the
+ * constraint could not be parsed or is empty.
+ *
+ * @param annotation annotation containing the constraint expression to
+ * parse
+ * @return parsed constraint
+ */
public static Constraint parse(AnnotationNode annotation) {
String constraints = ASMHelper.getAnnotationValue(annotation, "constraints", "");
return ConstraintParser.parse(constraints);
diff --git a/src/main/java/org/spongepowered/asm/util/JavaVersion.java b/src/main/java/org/spongepowered/asm/util/JavaVersion.java
index 342d6dfcc..731e996b5 100644
--- a/src/main/java/org/spongepowered/asm/util/JavaVersion.java
+++ b/src/main/java/org/spongepowered/asm/util/JavaVersion.java
@@ -36,6 +36,9 @@ public abstract class JavaVersion {
private JavaVersion() {}
+ /**
+ * Get the current java version, calculates if necessary
+ */
public static double current() {
if (JavaVersion.current == 0.0) {
JavaVersion.current = JavaVersion.resolveCurrentVersion();
diff --git a/src/main/java/org/spongepowered/asm/util/Locals.java b/src/main/java/org/spongepowered/asm/util/Locals.java
index 81603529c..1fb81cea4 100644
--- a/src/main/java/org/spongepowered/asm/util/Locals.java
+++ b/src/main/java/org/spongepowered/asm/util/Locals.java
@@ -54,13 +54,17 @@
/**
* Utility methods for working with local variables using ASM
*/
-public class Locals {
+public final class Locals {
/**
* Cached local variable lists, to avoid having to recalculate them
* (expensive) if multiple injectors are working with the same method
*/
private static final Map> calculatedLocalVariables = new HashMap>();
+
+ private Locals() {
+ // utility class
+ }
/**
* Injects appropriate LOAD opcodes into the supplied InsnList for each
@@ -70,6 +74,7 @@ public class Locals {
* RETURN values in locals)
* @param insns Instruction List to inject into
* @param pos Start position
+ * @param limit maximum number of locals to consume
*/
public static void loadLocals(Type[] locals, InsnList insns, int pos, int limit) {
for (; pos < locals.length && limit > 0; pos++) {
diff --git a/src/main/java/org/spongepowered/asm/util/ObfuscationUtil.java b/src/main/java/org/spongepowered/asm/util/ObfuscationUtil.java
index 5dc696562..02160f6af 100644
--- a/src/main/java/org/spongepowered/asm/util/ObfuscationUtil.java
+++ b/src/main/java/org/spongepowered/asm/util/ObfuscationUtil.java
@@ -54,10 +54,24 @@ public interface IClassRemapper {
private ObfuscationUtil() {}
+ /**
+ * Map a descriptor using the supplied rempper
+ *
+ * @param desc descriptor to remap
+ * @param remapper remapper to use
+ * @return mapped descriptor
+ */
public static String mapDescriptor(String desc, IClassRemapper remapper) {
return ObfuscationUtil.remapDescriptor(desc, remapper, false);
}
+ /**
+ * Unmap (inverse of map) a descriptor using the supplied rempper
+ *
+ * @param desc descriptor to unmap
+ * @param remapper remapper to use
+ * @return unmapped descriptor
+ */
public static String unmapDescriptor(String desc, IClassRemapper remapper) {
return ObfuscationUtil.remapDescriptor(desc, remapper, true);
}
diff --git a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java
index a18a08d27..6f95d5447 100644
--- a/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java
+++ b/src/main/java/org/spongepowered/asm/util/PrettyPrinter.java
@@ -486,7 +486,7 @@ public PrettyPrinter table(String... titles) {
* printer.table("Column 1", 30, "Column 2", 20, Alignment.RIGHT);
*
*
- * @param format
+ * @param format format string, see description
* @return fluent interface
*/
public PrettyPrinter table(Object... format) {
diff --git a/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java b/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java
index f7c02f193..e417d78d1 100644
--- a/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java
+++ b/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java
@@ -123,14 +123,25 @@ public SignaturePrinter(String name, Type returnType, Type[] argTypes, String[]
}
}
+ /**
+ * Return only the arguments portion of this signature as a Java-style block
+ */
public String getFormattedArgs() {
return this.appendArgs(new StringBuilder(), true).toString();
}
+ /**
+ * Get string representation of this signature's return type
+ */
public String getReturnType() {
return SignaturePrinter.getTypeName(this.returnType, false, this.fullyQualified);
}
+ /**
+ * Set modifiers on this signature using the supplied method node
+ *
+ * @param method method node to read modifiers from
+ */
public void setModifiers(MethodNode method) {
String returnType = SignaturePrinter.getTypeName(Type.getReturnType(method.desc), false, this.fullyQualified);
if ((method.access & Opcodes.ACC_PUBLIC) != 0) {
@@ -144,25 +155,50 @@ public void setModifiers(MethodNode method) {
}
}
+ /**
+ * Set modifiers on this signature explicitly. Use the special token
+ * ${returnType} to insert the return type into the modifier
+ * string.
+ *
+ * @param modifiers modifiers to prepend
+ * @return fluent interface
+ */
public SignaturePrinter setModifiers(String modifiers) {
this.modifiers = modifiers.replace("${returnType}", this.getReturnType());
return this;
}
+ /**
+ * Set whether this signature generates fully-qualified class output, mainly
+ * used when generating signatures for Mirror
+ *
+ * @param fullyQualified new value for fully-qualified
+ * @return fluent interface
+ */
public SignaturePrinter setFullyQualified(boolean fullyQualified) {
this.fullyQualified = fullyQualified;
return this;
}
+ /**
+ * Get whether this printer will fully-qualify class names in generated
+ * signatures
+ */
public boolean isFullyQualified() {
return this.fullyQualified;
}
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
@Override
public String toString() {
return this.appendArgs(new StringBuilder().append(this.modifiers).append(" ").append(this.name), false).toString();
}
+ /**
+ * Return this signature in descriptor format (return type after args)
+ */
public String toDescriptor() {
StringBuilder args = this.appendArgs(new StringBuilder(), true);
return args.append(SignaturePrinter.getTypeName(this.returnType, false, this.fullyQualified)).toString();
diff --git a/src/main/java/org/spongepowered/asm/util/VersionNumber.java b/src/main/java/org/spongepowered/asm/util/VersionNumber.java
index 50625e936..fa4c37c72 100644
--- a/src/main/java/org/spongepowered/asm/util/VersionNumber.java
+++ b/src/main/java/org/spongepowered/asm/util/VersionNumber.java
@@ -33,7 +33,7 @@
* format as a sequence of four shorts packed into a long. This is to
* facilitate meaningful comparison between version numbers.
*/
-public class VersionNumber implements Comparable, Serializable {
+public final class VersionNumber implements Comparable, Serializable {
private static final long serialVersionUID = 1L;
@@ -46,7 +46,7 @@ public class VersionNumber implements Comparable, Serializable {
/**
* Regex for matching a version number specified as a string
*/
- private static final Pattern versionNumberPattern =
+ private static final Pattern PATTERN =
Pattern.compile("^(\\d{1,5})(?:\\.(\\d{1,5})(?:\\.(\\d{1,5})(?:\\.(\\d{1,5}))?)?)?(-[a-zA-Z0-9_\\-]+)?$");
/**
@@ -190,7 +190,7 @@ private static VersionNumber parse(String version, VersionNumber defaultVersion)
return defaultVersion;
}
- Matcher versionNumberPatternMatcher = VersionNumber.versionNumberPattern.matcher(version);
+ Matcher versionNumberPatternMatcher = VersionNumber.PATTERN.matcher(version);
if (!versionNumberPatternMatcher.matches()) {
return defaultVersion;
}
diff --git a/src/main/java/org/spongepowered/asm/util/launchwrapper/LaunchClassLoaderUtil.java b/src/main/java/org/spongepowered/asm/util/launchwrapper/LaunchClassLoaderUtil.java
index 8e916132a..50d845f07 100644
--- a/src/main/java/org/spongepowered/asm/util/launchwrapper/LaunchClassLoaderUtil.java
+++ b/src/main/java/org/spongepowered/asm/util/launchwrapper/LaunchClassLoaderUtil.java
@@ -153,6 +153,9 @@ public void registerInvalidClass(String name) {
}
}
+ /**
+ * Get the classloader exclusions from the target classloader
+ */
public Set getClassLoaderExceptions() {
if (this.classLoaderExceptions != null) {
return this.classLoaderExceptions;
@@ -160,6 +163,9 @@ public Set getClassLoaderExceptions() {
return Collections.emptySet();
}
+ /**
+ * Get the transformer exclusions from the target classloader
+ */
public Set getTransformerExceptions() {
if (this.transformerExceptions != null) {
return this.transformerExceptions;
diff --git a/src/main/java/org/spongepowered/asm/util/throwables/LVTGeneratorException.java b/src/main/java/org/spongepowered/asm/util/throwables/LVTGeneratorException.java
index 012bac110..066464492 100644
--- a/src/main/java/org/spongepowered/asm/util/throwables/LVTGeneratorException.java
+++ b/src/main/java/org/spongepowered/asm/util/throwables/LVTGeneratorException.java
@@ -27,8 +27,8 @@
import org.spongepowered.asm.mixin.throwables.MixinException;
/**
- * Exception thrown when something goes horribly wrong whilst summoning the
- * antichrist generating the LVT for a target method.
+ * Exception thrown when something goes horribly wrong whilst summoning the
+ * antichrist generating the LVT for a target method.
*/
public class LVTGeneratorException extends MixinException {