fix: fixed the generator being called repeatedly

This commit is contained in:
zaaarf 2023-08-25 09:19:44 +02:00
parent f5cf21050f
commit 773880f323
No known key found for this signature in database
GPG key ID: 6445A5CD15E5B40C

View file

@ -92,12 +92,11 @@ public class GEBProcessor extends AbstractProcessor {
for(TypeElement ann : annotations) { for(TypeElement ann : annotations) {
if(ann.getQualifiedName().contentEquals(Listen.class.getName())) { if(ann.getQualifiedName().contentEquals(Listen.class.getName())) {
claimed = true; claimed = true;
for(Element e : env.getElementsAnnotatedWith(ann)) { for(Element e : env.getElementsAnnotatedWith(ann))
this.processListener(e); this.processListener(e);
if(!this.listenerMap.isEmpty()) { if(!this.listenerMap.isEmpty()) {
this.generateClasses(); this.generateClasses();
this.generateServiceProvider(); this.generateServiceProvider();
}
} }
} }
} }
@ -198,6 +197,7 @@ public class GEBProcessor extends AbstractProcessor {
listener.method.getSimpleName().toString(), event, eventParam); listener.method.getSimpleName().toString(), event, eventParam);
if(cancelable) callListenersBuilder if(cancelable) callListenersBuilder
.addStatement("if((($T) $N).isCanceled()) return true", this.cancelableEventInterface, eventParam); .addStatement("if((($T) $N).isCanceled()) return true", this.cancelableEventInterface, eventParam);
counter++;
} }
callListenersBuilder.addStatement("return false"); callListenersBuilder.addStatement("return false");