25
25
package org .spongepowered .plugin .processor ;
26
26
27
27
import static javax .tools .Diagnostic .Kind .ERROR ;
28
+ import static javax .tools .Diagnostic .Kind .WARNING ;
28
29
29
30
import org .spongepowered .api .event .Event ;
30
31
import org .spongepowered .api .event .Listener ;
50
51
import javax .tools .Diagnostic ;
51
52
52
53
@ SupportedAnnotationTypes (ListenerProcessor .LISTENER_ANNOTATION_CLASS )
53
- @ SupportedSourceVersion (SourceVersion .RELEASE_8 )
54
+ @ SupportedSourceVersion (SourceVersion .RELEASE_16 )
54
55
public class ListenerProcessor extends AbstractProcessor {
55
56
56
57
static final String LISTENER_ANNOTATION_CLASS = "org.spongepowered.api.event.Listener" ;
@@ -68,19 +69,16 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round
68
69
69
70
final Messager msg = this .processingEnv .getMessager ();
70
71
if (method .getModifiers ().contains (Modifier .STATIC )) {
71
- msg .printMessage (Diagnostic .Kind .ERROR , "method must not be static" , method );
72
- }
73
- if (!method .getModifiers ().contains (Modifier .PUBLIC )) {
74
- msg .printMessage (Diagnostic .Kind .ERROR , "method must be public" , method );
72
+ msg .printMessage (Diagnostic .Kind .ERROR , "Event listener method must not be static" , method );
75
73
}
76
74
if (method .getModifiers ().contains (Modifier .ABSTRACT )) {
77
- msg .printMessage (Diagnostic .Kind .ERROR , "method must not be abstract" , method );
75
+ msg .printMessage (Diagnostic .Kind .ERROR , "Event listener method must not be abstract" , method );
78
76
}
79
77
if (method .getEnclosingElement ().getKind ().isInterface ()) {
80
78
msg .printMessage (Diagnostic .Kind .ERROR , "interfaces cannot declare listeners" , method );
81
79
}
82
80
if (method .getReturnType ().getKind () != TypeKind .VOID ) {
83
- msg .printMessage (Diagnostic .Kind .ERROR , "method must return void" , method );
81
+ msg .printMessage (Diagnostic .Kind .ERROR , "Event listener method must return void" , method );
84
82
}
85
83
final List <? extends VariableElement > parameters = method .getParameters ();
86
84
if (parameters .isEmpty () || !this .isTypeSubclass (parameters .get (0 ), ListenerProcessor .EVENT_CLASS )) {
0 commit comments