aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-15 12:59:54 +0100
committer zaaarf <zaaarf@proton.me>2023-03-15 12:59:54 +0100
commit2463dd3e762391d5a35fd05269e63275e80b5a1d (patch)
tree33dd7c31973900934da07d9adec03955e23ad7f4 /src/main/java/ftbsc/lll
parent8fd7006a346e562ed11bdb3c0cfebba3197ff860 (diff)
fix: fixed MirroredTypesException
Diffstat (limited to 'src/main/java/ftbsc/lll')
-rw-r--r--src/main/java/ftbsc/lll/processor/LilleroProcessor.java15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java
index f6ef045..177e12f 100644
--- a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java
+++ b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java
@@ -15,6 +15,7 @@ import javax.annotation.processing.*;
import javax.lang.model.SourceVersion;
import javax.lang.model.element.*;
import javax.lang.model.type.ExecutableType;
+import javax.lang.model.type.MirroredTypesException;
import javax.lang.model.type.TypeMirror;
import javax.tools.Diagnostic;
import javax.tools.FileObject;
@@ -407,9 +408,19 @@ public class LilleroProcessor extends AbstractProcessor {
if(injectionCandidates.size() == 1)
injectionTarget = injectionCandidates.get(0);
- if(injectorAnn.params().length != 0) {
+ List<TypeMirror> params = new ArrayList<>();
+ try {
+ params.addAll(Arrays.stream(injectorAnn.params())
+ .map(Class::getCanonicalName)
+ .map(fqn -> processingEnv.getElementUtils().getTypeElement(fqn).asType())
+ .collect(Collectors.toList()));
+ } catch(MirroredTypesException e) {
+ params.addAll(e.getTypeMirrors());
+ }
+
+ if(params.size() != 0) {
StringBuilder descr = new StringBuilder("(");
- for(Class<?> p : injectorAnn.params())
+ for(TypeMirror p : params)
descr.append(descriptorFromType(TypeName.get(p)));
descr.append(")");
injectionCandidates =