Fix <clinit> not being appended if target class does not have it

This commit is contained in:
simon816 committed 2015-01-18 16:22:32 +00:00
1 parent db4db98b31
commit db3fc70cce
1 file changed
+7
@@ -561,8 +561,11 @@ public class MixinTransformer extends TreeTransformer {
targetMethodName = sourceMethod.name;
}
boolean found = false;
for (MethodNode method : targetClass.methods) {
if ((targetMethodName.equals(method.name)) && sourceMethod.desc.equals(method.desc)) {
found = true;
AbstractInsnNode returnNode = null;
Iterator<AbstractInsnNode> findReturnIter = method.instructions.iterator();
while (findReturnIter.hasNext()) {
@@ -582,6 +585,10 @@ public class MixinTransformer extends TreeTransformer {
}
}
}
if (!found) {
sourceMethod.name = targetMethodName;
targetClass.methods.add(sourceMethod);
}
}
/**