summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-25 18:27:31 +0100
committer zaaarf <zaaarf@proton.me>2023-03-25 18:27:31 +0100
commite2c4ccdce330da489a3863c23eb4012b53983415 (patch)
tree0c1f342c05faae7d242b27dca5f5122ee9eb62dc /src/main/java/ftbsc
parent193db6bf7b5cc767ff88527fc20ac52e6bb7d16c (diff)
fix: getting injector candidates from wrong list
Diffstat (limited to 'src/main/java/ftbsc')
-rw-r--r--src/main/java/ftbsc/lll/processor/LilleroProcessor.java12
1 files 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<ExecutableElement> matchedTargets;
+
//this will contain the classes to generate: the key is the class name
HashMap<String, InjectorInfo> 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
}
}
-
}
}