diff --git a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java index 4564d5b..04dcad7 100644 --- a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java +++ b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java @@ -202,7 +202,7 @@ public class LilleroProcessor extends AbstractProcessor { ClassContainer targetClass = ClassContainer.from( patchAnn, Patch::value, - patchAnn.innerClass(), + patchAnn.innerName(), this.processingEnv, this.mapper ); @@ -236,6 +236,7 @@ public class LilleroProcessor extends AbstractProcessor { //find and validate ClassContainer clazz = ClassContainer.findOrFallback( ClassContainer.from(cl, this.processingEnv, this.mapper), + patchAnn, proxyVar.getAnnotation(Find.class), this.processingEnv, this.mapper diff --git a/src/main/java/ftbsc/lll/processor/annotations/Patch.java b/src/main/java/ftbsc/lll/processor/annotations/Patch.java index f5d2698..0f73cdd 100644 --- a/src/main/java/ftbsc/lll/processor/annotations/Patch.java +++ b/src/main/java/ftbsc/lll/processor/annotations/Patch.java @@ -27,5 +27,5 @@ public @interface Patch { * defaults to empty string (not an inner class) * @since 0.5.0 */ - String innerClass() default ""; + String innerName() default ""; } diff --git a/src/main/java/ftbsc/lll/processor/tools/containers/ClassContainer.java b/src/main/java/ftbsc/lll/processor/tools/containers/ClassContainer.java index 110c0f0..889b027 100644 --- a/src/main/java/ftbsc/lll/processor/tools/containers/ClassContainer.java +++ b/src/main/java/ftbsc/lll/processor/tools/containers/ClassContainer.java @@ -3,6 +3,7 @@ package ftbsc.lll.processor.tools.containers; import ftbsc.lll.exceptions.TargetNotFoundException; import ftbsc.lll.processor.LilleroProcessor; import ftbsc.lll.processor.annotations.Find; +import ftbsc.lll.processor.annotations.Patch; import ftbsc.lll.processor.tools.obfuscation.ObfuscationMapper; import javax.annotation.processing.ProcessingEnvironment; @@ -127,16 +128,17 @@ public class ClassContainer { /** * Finds and builds a {@link ClassContainer} based on information contained - * within a {@link Find} annotation, else returns a fallback. + * within {@link Patch} or a {@link Find} annotations, else returns a fallback. * @param fallback the {@link ClassContainer} it falls back on + * @param p the {@link Patch} annotation to get info from * @param f the {@link Find} annotation to get info from * @param env the {@link ProcessingEnvironment} to perform the operation in * @param mapper the {@link ObfuscationMapper} to use, may be null * @return the built {@link ClassContainer} or the fallback if not enough information was present * @since 0.5.0 */ - public static ClassContainer findOrFallback(ClassContainer fallback, Find f, ProcessingEnvironment env, ObfuscationMapper mapper) { - if(f == null) return fallback; + public static ClassContainer findOrFallback(ClassContainer fallback, Patch p, Find f, ProcessingEnvironment env, ObfuscationMapper mapper) { + if(f == null) return ClassContainer.from(p, Patch::value, p.innerName(), env, mapper); ClassContainer cl = ClassContainer.from(f, Find::value, f.innerName(), env, mapper); return cl.fqn.equals("java.lang.Object") ? fallback diff --git a/src/main/java/ftbsc/lll/processor/tools/containers/FieldContainer.java b/src/main/java/ftbsc/lll/processor/tools/containers/FieldContainer.java index 6458c59..57d8c29 100644 --- a/src/main/java/ftbsc/lll/processor/tools/containers/FieldContainer.java +++ b/src/main/java/ftbsc/lll/processor/tools/containers/FieldContainer.java @@ -98,7 +98,7 @@ public class FieldContainer { ClassContainer parent = ClassContainer.findOrFallback( ClassContainer.from((TypeElement) finder.getEnclosingElement(), env, mapper), - f, env, mapper + patchAnn, f, env, mapper ); String name = f.name().equals("") ? finder.getSimpleName().toString() : f.name(); diff --git a/src/main/java/ftbsc/lll/processor/tools/containers/MethodContainer.java b/src/main/java/ftbsc/lll/processor/tools/containers/MethodContainer.java index 00141a1..441b882 100644 --- a/src/main/java/ftbsc/lll/processor/tools/containers/MethodContainer.java +++ b/src/main/java/ftbsc/lll/processor/tools/containers/MethodContainer.java @@ -103,7 +103,7 @@ public class MethodContainer { Patch patchAnn = stub.getEnclosingElement().getAnnotation(Patch.class); ClassContainer parent = ClassContainer.findOrFallback( ClassContainer.from((TypeElement) stub.getEnclosingElement(), env, mapper), - f, env, mapper + patchAnn, f, env, mapper ); String name = !t.methodName().equals("") ? t.methodName() //name was specified in target