From b793bddaa099e76acca01989eba75d874dff490f Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sat, 25 Mar 2023 20:41:28 +0100 Subject: fix: added missing case in main loop --- src/main/java/ftbsc/lll/processor/LilleroProcessor.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java index 7a85b8b..eabc2b3 100644 --- a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java +++ b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java @@ -223,13 +223,6 @@ public class LilleroProcessor extends AbstractProcessor { appendMemberFinderDefinition(targetClass, proxyVar, null, constructorBuilder, this.processingEnv, this.mapper); } - //declare it once for efficiency - List injectorNames = - injectors.stream() - .map(ExecutableElement::getSimpleName) - .map(Object::toString) - .collect(Collectors.toList()); - //targets that have matched at least once are put in here Set matchedTargets = new HashSet<>(); @@ -276,6 +269,10 @@ public class LilleroProcessor extends AbstractProcessor { throw new AmbiguousDefinitionException( String.format("Target specified user %s, but name was used by both a finder and injector.", targetAnn.of()) ); + else if(finderCandidates.size() == 0 && injectorCandidates.size() == 0) + throw new AmbiguousDefinitionException( + String.format("Could not find any candidate mathcing target %s", tg.getSimpleName().toString()) + ); else if(finderCandidates.size() == 0 && injectorCandidates.size() != 1) throw new AmbiguousDefinitionException( String.format("Found multiple candidate injectors for target %s::%s!", cl.getSimpleName(), tg.getSimpleName()) @@ -285,6 +282,7 @@ public class LilleroProcessor extends AbstractProcessor { String.format("Found multiple candidate finders for target %s::%s!", cl.getSimpleName(), tg.getSimpleName()) ); else { + matchedTargets.add(tg); if(injectorCandidates.size() == 1) { //matched an injector! toGenerate.put( @@ -307,6 +305,10 @@ public class LilleroProcessor extends AbstractProcessor { } } + //find orphan targets and warn + Set orphanTargets = targets.stream().filter(t -> !matchedTargets.contains(t)).collect(Collectors.toSet()); + //TODO! + //iterate over the map and generate the classes for(String injName : toGenerate.keySet()) { String targetMethodDescriptor = descriptorFromExecutableElement(toGenerate.get(injName).target); -- cgit v1.2.3-56-ga3b1