From 3cea0d3e663e23f92649a85d5276aadab4fcb323 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sat, 25 Mar 2023 21:48:53 +0100 Subject: [PATCH] fix: logical flaw in error handling --- src/main/java/ftbsc/lll/processor/LilleroProcessor.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java index 39f680a..e0b8d72 100644 --- a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java +++ b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java @@ -248,18 +248,17 @@ public class LilleroProcessor extends AbstractProcessor { .stream() .filter(i -> i.getSimpleName().contentEquals(targetAnn.of())) .collect(Collectors.toList()); - } else if(injectors.size() == 1) { - //case 2: there is only one injector + } else if(injectors.size() == 1 && targets.size() == 1) { + //case 2: there is only one target, must use it for that injector finderCandidates = new ArrayList<>(); //no candidates injectorCandidates = new ArrayList<>(); injectorCandidates.add(injectors.get(0)); } else { - //case 3: try to match by injectTargetName or same name for finers - String inferredName = "inject" + tg.getSimpleName(); + //case 3: try to match by injectTargetName or same name for finders injectorCandidates = injectorCandidates .stream() - .filter(t -> t.getSimpleName().toString().equalsIgnoreCase(inferredName)) + .filter(t -> t.getSimpleName().toString().equalsIgnoreCase("inject" + tg.getSimpleName())) .collect(Collectors.toList()); finderCandidates = finderCandidates