Compare commits

..

No commits in common. "9379e6bb947909b2422898f65e13444ecd85c21b" and "4a5b94a9b747968ef6608bdfa105c5eda6921813" have entirely different histories.

View File

@ -63,10 +63,6 @@ public class EventProcessor extends AbstractProcessor {
else else
pass = true; pass = true;
// Warn the user about unused return values
if (useParameter && eventHandler.getReturnType().getKind() != TypeKind.VOID)
warning(eventHandler, "Unused return value");
// Abort checking if the handler signature is incorrect // Abort checking if the handler signature is incorrect
if (!pass) if (!pass)
continue; continue;
@ -84,20 +80,14 @@ public class EventProcessor extends AbstractProcessor {
} }
} }
// Detect missing or useless @Polymorphic
boolean polymorphic = eventHandler.getAnnotation(Polymorphic.class) != null;
Element eventElement = ((DeclaredType) eventType).asElement();
// Check for handlers for abstract types that aren't polymorphic // Check for handlers for abstract types that aren't polymorphic
if (!polymorphic && (eventElement.getKind() == ElementKind.INTERFACE Element eventElement = ((DeclaredType) eventType).asElement();
|| eventElement.getModifiers().contains(Modifier.ABSTRACT))) if (eventHandler.getAnnotation(Polymorphic.class) == null
&& (eventElement.getKind() == ElementKind.INTERFACE
|| eventElement.getModifiers().contains(Modifier.ABSTRACT))) {
warning(eventHandler, warning(eventHandler,
"Parameter should be instantiable or handler should use @Polymorphic"); "Parameter should be instantiable or handler should use @Polymorphic");
}
// Check for handlers for final types that are polymorphic
else if (polymorphic && eventElement.getModifiers().contains(Modifier.FINAL))
warning(eventHandler,
"@Polymorphic should be removed as parameter cannot be subclassed");
} }
} }