Skip to content

Commit

Permalink
fix overwrite, static shadows not being remapped at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
asiekierka committed Sep 16, 2019
1 parent 59db546 commit ec491e3
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,6 @@ protected boolean attachSpecialMethod(MixinTargetContext context, MixinMethodNod
Method method = this.getSpecialMethod(mixinMethod, type);
MethodNode target = context.findMethod(mixinMethod, annotation);
if (target == null) {
if (type.isOverwrite) {
return false;
}
target = context.findRemappedMethod(mixinMethod);
if (target == null) {
throw new InvalidMixinException(this.mixin,
Expand Down Expand Up @@ -731,7 +728,9 @@ protected void transformMethod(MethodInsnNode methodNode) {
throw new RuntimeException(new ClassNotFoundException(methodNode.owner.replace('/', '.')));
}

Method method = owner.findMethodInHierarchy(methodNode, SearchType.ALL_CLASSES, ClassInfo.INCLUDE_PRIVATE);
int includeStatic = (methodNode.getOpcode() == Opcodes.INVOKESTATIC
? ClassInfo.INCLUDE_STATIC : 0);
Method method = owner.findMethodInHierarchy(methodNode, SearchType.ALL_CLASSES, ClassInfo.INCLUDE_PRIVATE | includeStatic);
metaTimer.end();

if (method != null && method.isRenamed()) {
Expand All @@ -747,8 +746,10 @@ protected void transformField(FieldInsnNode fieldNode) {
if (owner == null) {
throw new RuntimeException(new ClassNotFoundException(fieldNode.owner.replace('/', '.')));
}

Field field = owner.findField(fieldNode, ClassInfo.INCLUDE_PRIVATE);

int includeStatic = ((fieldNode.getOpcode() == Opcodes.GETSTATIC || fieldNode.getOpcode() == Opcodes.PUTSTATIC)
? ClassInfo.INCLUDE_STATIC : 0);
Field field = owner.findField(fieldNode, ClassInfo.INCLUDE_PRIVATE | includeStatic);
metaTimer.end();

if (field != null && field.isRenamed()) {
Expand Down

0 comments on commit ec491e3

Please sign in to comment.