Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-16 21:10:30 +01:00
Fix annotation processor choking on event subscribers
Dieser Commit ist enthalten in:
Ursprung
07f8980f82
Commit
348ea4cc23
@ -22,4 +22,5 @@ class AnnotationProcessorConstants {
|
||||
static final String PLUGIN_ANNOTATION_CLASS = "com.velocitypowered.api.plugin.Plugin";
|
||||
static final String SUBSCRIBE_ANNOTATION_CLASS = "com.velocitypowered.api.event.Subscribe";
|
||||
static final String EVENTTASK_CLASS = "com.velocitypowered.api.event.EventTask";
|
||||
static final String EVENT_INTERFACE= "com.velocitypowered.api.event.Event";
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package com.velocitypowered.annotationprocessor;
|
||||
|
||||
import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.EVENTTASK_CLASS;
|
||||
import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.EVENT_INTERFACE;
|
||||
import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.PLUGIN_ANNOTATION_CLASS;
|
||||
import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.SUBSCRIBE_ANNOTATION_CLASS;
|
||||
|
||||
@ -33,7 +34,6 @@ import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.processing.AbstractProcessor;
|
||||
import javax.annotation.processing.Messager;
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
import javax.annotation.processing.RoundEnvironment;
|
||||
import javax.annotation.processing.SupportedAnnotationTypes;
|
||||
import javax.lang.model.SourceVersion;
|
||||
@ -99,7 +99,7 @@ public class ApiAnnotationProcessor extends AbstractProcessor {
|
||||
}
|
||||
final List<? extends VariableElement> parameters = method.getParameters();
|
||||
if (parameters.isEmpty()
|
||||
|| !this.isTypeSubclass(parameters.get(0), SUBSCRIBE_ANNOTATION_CLASS)) {
|
||||
|| !this.isTypeSubclass(parameters.get(0), EVENT_INTERFACE)) {
|
||||
msg.printMessage(Diagnostic.Kind.ERROR,
|
||||
"method must have an Event as its first parameter", method);
|
||||
}
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren