From 24cee5fb483ceca28d0e96e8ea12392ad321ca74 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Wed, 4 Dec 2024 10:37:58 +0100 Subject: [PATCH] fix: properly handle events with generics --- src/main/java/ftbsc/geb/processor/GEBProcessor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/ftbsc/geb/processor/GEBProcessor.java b/src/main/java/ftbsc/geb/processor/GEBProcessor.java index c6ff58b..f29ef06 100644 --- a/src/main/java/ftbsc/geb/processor/GEBProcessor.java +++ b/src/main/java/ftbsc/geb/processor/GEBProcessor.java @@ -243,11 +243,14 @@ public class GEBProcessor extends AbstractProcessor { callListenersBuilder.addStatement("return true"); + TypeMirror erasedEvent = this.processingEnv.getTypeUtils().erasure(event); MethodSpec eventType = MethodSpec.methodBuilder("eventType") .addModifiers(Modifier.PUBLIC) .addAnnotation(Override.class) - .returns(ParameterizedTypeName.get(ClassName.get(Class.class), TypeName.get(event))) - .addStatement("return $T.class", event) + .addAnnotation(AnnotationSpec.builder(SuppressWarnings.class) + .addMember("value" , "{$S}", "rawtypes").build()) + .returns(ParameterizedTypeName.get(Class.class)) + .addStatement("return $T.class", erasedEvent) .build(); String clazzName = String.format("%sDispatcher", eventClass.getSimpleName());