diff options
author | zaaarf <zaaarf@proton.me> | 2023-08-25 02:49:48 +0200 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-08-25 02:49:48 +0200 |
commit | 26c4377317296dadf14d16ae678fc0cc6a49dc46 (patch) | |
tree | bd6cbb445541ce22cbf33eb629574e3e244a0896 | |
parent | a0dbda4c5f8c78da927c7a0348a670d28619122b (diff) |
fix: fixed code generation
-rw-r--r-- | src/main/java/ftbsc/geb/processor/GEBProcessor.java | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main/java/ftbsc/geb/processor/GEBProcessor.java b/src/main/java/ftbsc/geb/processor/GEBProcessor.java index ffaa078..c3b6ff2 100644 --- a/src/main/java/ftbsc/geb/processor/GEBProcessor.java +++ b/src/main/java/ftbsc/geb/processor/GEBProcessor.java @@ -8,10 +8,8 @@ import ftbsc.geb.api.annotations.Listen; import ftbsc.geb.exceptions.BadListenerArgumentsException; import ftbsc.geb.exceptions.MissingInterfaceException; -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.ProcessingEnvironment; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; +import javax.annotation.processing.*; +import javax.lang.model.SourceVersion; import javax.lang.model.element.*; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; @@ -156,7 +154,7 @@ public class GEBProcessor extends AbstractProcessor { ParameterSpec listenersParam = ParameterSpec.builder(ParameterizedTypeName.get( ClassName.get("java.util", "Map"), ParameterizedTypeName.get( ClassName.get("java.lang", "Class"), - WildcardTypeName.subtypeOf(TypeName.get(this.dispatcherInterface))), + WildcardTypeName.subtypeOf(TypeName.get(this.listenerInterface))), ClassName.get(this.listenerInterface)), "listeners") .build(); @@ -174,8 +172,8 @@ public class GEBProcessor extends AbstractProcessor { String varName = String.format("listener%d", counter); callListenersBuilder .addStatement("$T $L = $N.get($T.class)", this.listenerInterface, varName, listenersParam, listener.parent) - .addStatement("if($L.isActive()) (($T) $L).$L($N)", varName, listener.parent, varName, - listener.method.getSimpleName().toString(), eventParam); + .addStatement("if($L.isActive()) (($T) $L).$L(($T) $N)", varName, listener.parent, varName, + listener.method.getSimpleName().toString(), event, eventParam); } MethodSpec eventType = MethodSpec.methodBuilder("eventType") |