From 5fd954a1188afb230f2b1ae70834110e742a3c99 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Fri, 17 Mar 2023 19:09:32 +0100 Subject: fix: fixed NoClassDefFoundError for non-java classes --- src/main/java/ftbsc/lll/processor/LilleroProcessor.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java index a965068..957785b 100644 --- a/src/main/java/ftbsc/lll/processor/LilleroProcessor.java +++ b/src/main/java/ftbsc/lll/processor/LilleroProcessor.java @@ -329,10 +329,16 @@ public class LilleroProcessor extends AbstractProcessor { for(Modifier mod : targetMethod.getModifiers()) b.addStatement("bd.addModifier($L)", mapModifier(mod)); - for(VariableElement p : targetMethod.getParameters()) - b.addStatement("bd.addParameter($T.class)",p.asType()); + for(VariableElement p : targetMethod.getParameters()) { + if(p.asType().getKind().isPrimitive()) + b.addStatement("bd.addParameter($T.class)", p.asType()); + else b.addStatement("bd.addParameter($S)", p.asType().toString()); + } + + if(targetMethod.getReturnType().getKind().isPrimitive()) + b.addStatement("bd.setReturnType($T.class)", targetMethod.getReturnType()); + else b.addStatement("bd.setReturnType($S)", targetMethod.getReturnType().toString()); - b.addStatement("bd.setReturnType($T.class)", targetMethod.getReturnType()); b.addStatement("return bd.build()"); generated.add(b.build()); @@ -358,7 +364,10 @@ public class LilleroProcessor extends AbstractProcessor { for(Modifier mod : targetField.getModifiers()) b.addStatement("bd.addModifier($L)", mapModifier(mod)); - b.addStatement("bd.setType($T.class)", targetField.asType()); + if(targetField.asType().getKind().isPrimitive()) + b.addStatement("bd.setType($T.class)", targetField.asType()); + else b.addStatement("bd.setType($S)", targetField.asType().toString()); + b.addStatement("return bd.build()"); generated.add(b.build()); -- cgit v1.2.3-56-ga3b1