summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/processor
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-04-13 11:12:41 +0200
committer zaaarf <zaaarf@proton.me>2023-04-13 11:12:41 +0200
commita259d844a3cba99867be6415999b8c697b31adfb (patch)
treef98464735063afe1d8019361256c8057eb103880 /src/main/java/ftbsc/lll/processor
parentf1c413eb2dbbe898ef5faacb8078c0c64d9d0b81 (diff)
fix: injector generated correctly0.6.0
Diffstat (limited to 'src/main/java/ftbsc/lll/processor')
-rw-r--r--src/main/java/ftbsc/lll/processor/tools/JavaPoetUtils.java23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/main/java/ftbsc/lll/processor/tools/JavaPoetUtils.java b/src/main/java/ftbsc/lll/processor/tools/JavaPoetUtils.java
index b09ffba..875ea67 100644
--- a/src/main/java/ftbsc/lll/processor/tools/JavaPoetUtils.java
+++ b/src/main/java/ftbsc/lll/processor/tools/JavaPoetUtils.java
@@ -151,27 +151,20 @@ public class JavaPoetUtils {
MethodSpec.Builder injectBuilder = MethodSpec.methodBuilder("inject")
.addModifiers(Modifier.PUBLIC)
.returns(void.class)
- .addAnnotation(Override.class);
-
- int argumentCount = inj.injector.getParameters().size();
-
- if(argumentCount == 2) {
- injectBuilder
- .addParameter(ParameterSpec.builder(
- TypeName.get(env
- .getElementUtils()
- .getTypeElement("org.objectweb.asm.tree.ClassNode").asType()), "clazz")
- .build());
- }
-
- injectBuilder
+ .addAnnotation(Override.class)
+ .addParameter(ParameterSpec.builder(
+ TypeName.get(env
+ .getElementUtils()
+ .getTypeElement("org.objectweb.asm.tree.ClassNode").asType()), "clazz")
+ .build())
.addParameter(ParameterSpec.builder(
TypeName.get(env
.getElementUtils()
.getTypeElement("org.objectweb.asm.tree.MethodNode").asType()), "main")
.build());
- if(argumentCount == 2) injectBuilder.addStatement("super.$L(clazz, main)", inj.injector.getSimpleName());
+ if(inj.injector.getParameters().size() == 2)
+ injectBuilder.addStatement("super.$L(clazz, main)", inj.injector.getSimpleName());
else injectBuilder.addStatement("super.$L(main)", inj.injector.getSimpleName());
return injectBuilder.build();