mirror of
https://github.com/zaaarf/geb-processor.git
synced 2024-12-22 17:44:53 +01:00
fix: properly handle events with generics
This commit is contained in:
parent
22a60c7ed3
commit
24cee5fb48
1 changed files with 5 additions and 2 deletions
|
@ -243,11 +243,14 @@ public class GEBProcessor extends AbstractProcessor {
|
||||||
|
|
||||||
callListenersBuilder.addStatement("return true");
|
callListenersBuilder.addStatement("return true");
|
||||||
|
|
||||||
|
TypeMirror erasedEvent = this.processingEnv.getTypeUtils().erasure(event);
|
||||||
MethodSpec eventType = MethodSpec.methodBuilder("eventType")
|
MethodSpec eventType = MethodSpec.methodBuilder("eventType")
|
||||||
.addModifiers(Modifier.PUBLIC)
|
.addModifiers(Modifier.PUBLIC)
|
||||||
.addAnnotation(Override.class)
|
.addAnnotation(Override.class)
|
||||||
.returns(ParameterizedTypeName.get(ClassName.get(Class.class), TypeName.get(event)))
|
.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class)
|
||||||
.addStatement("return $T.class", event)
|
.addMember("value" , "{$S}", "rawtypes").build())
|
||||||
|
.returns(ParameterizedTypeName.get(Class.class))
|
||||||
|
.addStatement("return $T.class", erasedEvent)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
String clazzName = String.format("%sDispatcher", eventClass.getSimpleName());
|
String clazzName = String.format("%sDispatcher", eventClass.getSimpleName());
|
||||||
|
|
Loading…
Reference in a new issue