From ec491e3b5d131b657bd095652f0d5195cd33a7cf Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sun, 21 Apr 2019 00:17:43 +0200 Subject: [PATCH] fix overwrite, static shadows not being remapped at runtime --- .../transformer/MixinPreProcessorStandard.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 00bbe66b..67217458 100644 --- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java +++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.java @@ -419,9 +419,6 @@ class MixinPreProcessorStandard { 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, @@ -731,7 +728,9 @@ class MixinPreProcessorStandard { 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()) { @@ -747,8 +746,10 @@ class MixinPreProcessorStandard { 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()) {