Added "remap" arg to let reobf processing be skipped per-member basis

This commit is contained in:
Mumfrey committed 2015-01-05 16:11:17 +00:00
1 parent 3b3a16db75
commit fb64777a41
6 files changed
+74 -9

No files matched your search

@@ -45,4 +45,15 @@ public @interface Mixin {
* Priority for the mixin, relative to other mixins targetting the same classes
*/
public int priority() default 1000;
/**
* By default, the annotation processor will attempt to locate an obfuscation mapping for all {@link Shadow} and
* {@link org.spongepowered.asm.mixin.injection.Inject} annotated members since it is anticipated that in general the target of a {@link Mixin}
* will be an obfuscated class and all annotated members will need to be added to the obfuscation table. However since it is possible to also
* apply mixins to non-obfuscated targets it may be desirable to suppress the compiler warnings which would otherwise be generated. This can be
* done on an individual member basis by setting <code>remap</code> to <em>false</em> on the individual annotations, or disabled for the entire
* mixin by setting the value here to <em>false</em>. Doing so will cause the annotation processor to skip all annotations in this mixin when
* building the obfuscation table.
*/
public boolean remap() default true;
}
@@ -65,4 +65,12 @@ public @interface Shadow {
*/
public String prefix() default "shadow$";
/**
* By default, the annotation processor will attempt to locate an obfuscation mapping for all {@link Shadow} methods since it is anticipated that
* in general the target of a {@link Shadow} annotation will be an obfuscated field or method in the target class. However since it is possible
* to also apply mixins to non-obfuscated targets (or non-obfuscated methods in obfuscated targets, such as methods added by Forge) it may be
* desirable to suppress the compiler warning which would otherwise be generated. Setting this value to <em>false</em> will cause the annotation
* processor to skip this annotation when attempting to build the obfuscation table for the mixin.
*/
public boolean remap() default true;
}
@@ -58,4 +58,14 @@ public @interface Inject {
* Set to true to allow local variables to be captured from the target method as well as method parameters.
*/
// public boolean captureLocals() default false;
/**
* By default, the annotation processor will attempt to locate an obfuscation mapping for all {@link Inject} methods since it is anticipated that
* in general the target of a {@link Inject} annotation will be an obfuscated method in the target class. However since it is possible to also
* apply mixins to non-obfuscated targets (or non-obfuscated methods in obfuscated targets, such as methods added by Forge) it may be necessary
* to suppress the compiler error which would otherwise be generated. Setting this value to <em>false</em> will cause the annotation processor
* to skip this annotation when attempting to build the obfuscation table for the mixin.
*/
public boolean remap() default true;
}
@@ -118,7 +118,8 @@ public abstract class InjectionPoint {
public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes) {
boolean found = false;
@SuppressWarnings("unchecked") ArrayList<AbstractInsnNode>[] allNodes = new ArrayList[this.components.length];
@SuppressWarnings({ "unchecked", "rawtypes" })
ArrayList<AbstractInsnNode>[] allNodes = new ArrayList[this.components.length];
for (int i = 0; i < this.components.length; i++) {
allNodes[i] = new ArrayList<AbstractInsnNode>();