mirror of
https://github.com/zaaarf/lillero-processor.git
synced 2024-11-22 02:14:49 +01:00
fix: injector generated correctly
This commit is contained in:
parent
f1c413eb2d
commit
a259d844a3
1 changed files with 8 additions and 15 deletions
|
@ -151,27 +151,20 @@ public class JavaPoetUtils {
|
||||||
MethodSpec.Builder injectBuilder = MethodSpec.methodBuilder("inject")
|
MethodSpec.Builder injectBuilder = MethodSpec.methodBuilder("inject")
|
||||||
.addModifiers(Modifier.PUBLIC)
|
.addModifiers(Modifier.PUBLIC)
|
||||||
.returns(void.class)
|
.returns(void.class)
|
||||||
.addAnnotation(Override.class);
|
.addAnnotation(Override.class)
|
||||||
|
.addParameter(ParameterSpec.builder(
|
||||||
int argumentCount = inj.injector.getParameters().size();
|
TypeName.get(env
|
||||||
|
.getElementUtils()
|
||||||
if(argumentCount == 2) {
|
.getTypeElement("org.objectweb.asm.tree.ClassNode").asType()), "clazz")
|
||||||
injectBuilder
|
.build())
|
||||||
.addParameter(ParameterSpec.builder(
|
|
||||||
TypeName.get(env
|
|
||||||
.getElementUtils()
|
|
||||||
.getTypeElement("org.objectweb.asm.tree.ClassNode").asType()), "clazz")
|
|
||||||
.build());
|
|
||||||
}
|
|
||||||
|
|
||||||
injectBuilder
|
|
||||||
.addParameter(ParameterSpec.builder(
|
.addParameter(ParameterSpec.builder(
|
||||||
TypeName.get(env
|
TypeName.get(env
|
||||||
.getElementUtils()
|
.getElementUtils()
|
||||||
.getTypeElement("org.objectweb.asm.tree.MethodNode").asType()), "main")
|
.getTypeElement("org.objectweb.asm.tree.MethodNode").asType()), "main")
|
||||||
.build());
|
.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());
|
else injectBuilder.addStatement("super.$L(main)", inj.injector.getSimpleName());
|
||||||
|
|
||||||
return injectBuilder.build();
|
return injectBuilder.build();
|
||||||
|
|
Loading…
Reference in a new issue