mirror of
https://github.com/zaaarf/lillero-processor.git
synced 2024-11-13 01:59:22 +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")
|
||||
.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();
|
||||
|
|
Loading…
Reference in a new issue