mirror of
https://github.com/zaaarf/lillero-processor.git
synced 2024-11-22 04:14:49 +01:00
fix: skip invalid bare injectors
This commit is contained in:
parent
ee12ab20c1
commit
fbd3d0c35a
1 changed files with 12 additions and 8 deletions
|
@ -145,17 +145,21 @@ public class LilleroProcessor extends AbstractProcessor {
|
|||
if(!validInjectors.isEmpty())
|
||||
validInjectors.forEach(this::generateClasses);
|
||||
} else if(annotation.getQualifiedName().contentEquals(RegisterBareInjector.class.getName())) {
|
||||
for(Element e : roundEnv.getElementsAnnotatedWith(annotation))
|
||||
TypeMirror injectorType = this.processingEnv.getElementUtils().getTypeElement("ftbsc.lll.IInjector").asType();
|
||||
for(Element e : roundEnv.getElementsAnnotatedWith(annotation)) {
|
||||
if(this.processingEnv.getTypeUtils().isAssignable(e.asType(), injectorType))
|
||||
this.generatedInjectors.add(((TypeElement) e).getQualifiedName().toString());
|
||||
else this.processingEnv.getMessager().printMessage(Diagnostic.Kind.WARNING, String.format(
|
||||
"Class %s annotated with @RegisterBareInjector is not an instance of IInjector, skipping...",
|
||||
((TypeElement) e).getQualifiedName().toString()
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!this.generatedInjectors.isEmpty()) {
|
||||
generateServiceProvider();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
} else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue