mirror of
https://github.com/zaaarf/geb-processor.git
synced 2024-12-22 12:04:54 +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");
|
||||
|
||||
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());
|
||||
|
|
Loading…
Reference in a new issue