fix: void is apparently not a primitive

This commit is contained in:
zaaarf 2023-03-18 22:43:42 +01:00
parent b394f7c5f0
commit 597fda2362
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
2 changed files with 3 additions and 4 deletions

View file

@ -218,7 +218,6 @@ public class LilleroProcessor extends AbstractProcessor {
if(injectionCandidates.size() == 1) if(injectionCandidates.size() == 1)
injectionTarget = injectionCandidates.get(0); injectionTarget = injectionCandidates.get(0);
else { else {
List<TypeMirror> params = classArrayFromAnnotation(injectorAnn, Injector::params, processingEnv.getElementUtils()); List<TypeMirror> params = classArrayFromAnnotation(injectorAnn, Injector::params, processingEnv.getElementUtils());

View file

@ -7,7 +7,7 @@ import ftbsc.lll.proxies.FieldProxy;
import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.Modifier; import javax.lang.model.element.Modifier;
import javax.lang.model.type.ArrayType; import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements; import javax.lang.model.util.Elements;
import java.lang.annotation.Annotation; import java.lang.annotation.Annotation;
@ -125,7 +125,7 @@ public class JavaPoetUtils {
*/ */
public static void addTypeToProxyGenerator(MethodSpec.Builder b, String proxyBuilderName, String proxyBuilderMethod, TypeMirror t) { public static void addTypeToProxyGenerator(MethodSpec.Builder b, String proxyBuilderName, String proxyBuilderMethod, TypeMirror t) {
String insn = String.format("%s.%s", proxyBuilderName, proxyBuilderMethod); String insn = String.format("%s.%s", proxyBuilderName, proxyBuilderMethod);
if(t.getKind().isPrimitive()) if(t.getKind().isPrimitive() || t.getKind() == TypeKind.VOID)
b.addStatement(insn + "($T.class)", t); b.addStatement(insn + "($T.class)", t);
else { else {
ArrayContainer arr = new ArrayContainer(t); ArrayContainer arr = new ArrayContainer(t);
@ -134,7 +134,7 @@ public class JavaPoetUtils {
type = ((ParameterizedTypeName) type).rawType; type = ((ParameterizedTypeName) type).rawType;
b.addStatement( b.addStatement(
insn + "($S, $L)", insn + "($S, $L)",
type, type.toString(),
arr.arrayLevel arr.arrayLevel
); );
} }