From e2c4ccdce330da489a3863c23eb4012b53983415 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sat, 25 Mar 2023 18:27:31 +0100 Subject: [PATCH] fix: getting injector candidates from wrong list --- .../java/ftbsc/lll/processor/LilleroProcessor.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java index 952647d..53781a8 100644 --- a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java +++ b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java @@ -200,7 +200,7 @@ public class LilleroProcessor extends AbstractProcessor { //take care of TypeProxies and FieldProxies first for(VariableElement proxyVar : finders) { ProxyType type = getProxyType(proxyVar); - if(type == ProxyType.METHOD) //methods will be handled later + if(type == ProxyType.METHOD && !proxyVar.getAnnotation(Find.class).name().equals("")) //methods will be handled later continue; //case-specific handling if(type == ProxyType.TYPE) { @@ -214,7 +214,7 @@ public class LilleroProcessor extends AbstractProcessor { clazz.fqnObf, //use obf name, at runtime it will be obfuscated mapModifiers(clazz.elem.getModifiers()) ); - } else if(type == ProxyType.FIELD) + } else if(type == ProxyType.FIELD || type == ProxyType.METHOD) appendMemberFinderDefinition(targetClass, proxyVar, null, constructorBuilder, this.processingEnv, this.mapper); finders.remove(proxyVar); //remove finders that have already been processed } @@ -226,6 +226,9 @@ public class LilleroProcessor extends AbstractProcessor { .map(Object::toString) .collect(Collectors.toList()); + //targets that have matched at least once are put in here + Set matchedTargets; + //this will contain the classes to generate: the key is the class name HashMap toGenerate = new HashMap<>(); @@ -252,8 +255,8 @@ public class LilleroProcessor extends AbstractProcessor { //case 2: there is only one injector finderCandidates = new ArrayList<>(); //no candidates injectorCandidates = new ArrayList<>(); - injectorCandidates.add(targets.get(0)); - } else { + injectorCandidates.add(injectors.get(0)); + } else { //todo match finders based on same name //case 3: try to match by injectTargetName finderCandidates = new ArrayList<>(); //no candidates String inferredName = "inject" + tg.getSimpleName(); @@ -293,7 +296,6 @@ public class LilleroProcessor extends AbstractProcessor { finders.remove(finder); //unlike injectors, finders can't apply to multiple targets } } - } }