|
57 | 57 | import javax.lang.model.util.Types;
|
58 | 58 |
|
59 | 59 | @SupportedAnnotationTypes(ListenerProcessor.LISTENER_ANNOTATION_CLASS)
|
60 |
| -@SupportedSourceVersion(SourceVersion.RELEASE_8) |
| 60 | +@SupportedSourceVersion(SourceVersion.RELEASE_16) |
61 | 61 | public class ListenerProcessor extends AbstractProcessor {
|
62 | 62 |
|
63 | 63 | static final String LISTENER_ANNOTATION_CLASS = "org.spongepowered.api.event.Listener";
|
@@ -86,24 +86,21 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round
|
86 | 86 | final ExecutableElement method = (ExecutableElement) e;
|
87 | 87 |
|
88 | 88 | if (method.getModifiers().contains(Modifier.STATIC)) {
|
89 |
| - this.error("method must not be static", method); |
90 |
| - } |
91 |
| - if (!method.getModifiers().contains(Modifier.PUBLIC)) { |
92 |
| - this.error("method must be public", method); |
| 89 | + this.error("Event listener method must not be static", method); |
93 | 90 | }
|
94 | 91 | if (method.getModifiers().contains(Modifier.ABSTRACT)) {
|
95 |
| - this.error("method must not be abstract", method); |
| 92 | + this.error("Event listener method must not be abstract", method); |
96 | 93 | }
|
97 | 94 | if (method.getEnclosingElement().getKind().isInterface()) {
|
98 | 95 | this.error("interfaces cannot declare listeners", method);
|
99 | 96 | }
|
100 | 97 | if (method.getReturnType().getKind() != TypeKind.VOID) {
|
101 |
| - this.error("method must return void", method); |
| 98 | + this.error("Event listener method must return void", method); |
102 | 99 | }
|
103 | 100 | final List<? extends VariableElement> parameters = method.getParameters();
|
104 | 101 | final DeclaredType eventType;
|
105 | 102 | if (parameters.isEmpty() || !this.isTypeSubclass(parameters.get(0), ListenerProcessor.EVENT_CLASS)) {
|
106 |
| - this.error("method must have an Event as its first parameter", method); |
| 103 | + this.error("Event listener method must have an Event as its first parameter", method); |
107 | 104 | eventType = null;
|
108 | 105 | } else {
|
109 | 106 | eventType = (DeclaredType) parameters.get(0).asType();
|
|
0 commit comments