Skip to content

Commit 3cdf000

Browse files
committed
ffs i thought i did headers
1 parent 9770da0 commit 3cdf000

File tree

4 files changed

+51
-7
lines changed

4 files changed

+51
-7
lines changed

src/ap/java/org/spongepowered/plugin/processor/ListenerParameterAnnotation.java

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*
2+
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
125
package org.spongepowered.plugin.processor;
226

327
import org.checkerframework.checker.nullness.qual.Nullable;
@@ -9,10 +33,8 @@
933

1034
import java.lang.annotation.Annotation;
1135
import java.util.HashMap;
12-
import java.util.List;
1336
import java.util.Map;
1437
import java.util.Set;
15-
1638
import javax.lang.model.element.AnnotationValue;
1739
import javax.lang.model.element.Element;
1840
import javax.lang.model.element.ElementKind;
@@ -95,7 +117,7 @@ void validate(final ParameterContext ctx) {
95117
}
96118

97119
TypeMirror expectedType = ((ExecutableType) ctx.types().asMemberOf(ctx.eventType().get(), possible)).getReturnType();
98-
if (expectedType.getKind() == TypeKind.DECLARED) {// maybe Optional, if so unwrap
120+
if (expectedType.getKind() == TypeKind.DECLARED) { // maybe Optional, if so unwrap
99121
final DeclaredType declared = (DeclaredType) expectedType;
100122
if (this.isOptional(declared) && declared.getTypeArguments().size() == 1 && !this.isOptional(ctx.param().asType())) {
101123
expectedType = declared.getTypeArguments().get(0);

src/ap/java/org/spongepowered/plugin/processor/ListenerProcessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ public boolean process(final Set<? extends TypeElement> annotations, final Round
9595
this.error("method must not be abstract", method);
9696
}
9797
if (method.getEnclosingElement().getKind().isInterface()) {
98-
this.error( "interfaces cannot declare listeners", method);
98+
this.error("interfaces cannot declare listeners", method);
9999
}
100100
if (method.getReturnType().getKind() != TypeKind.VOID) {
101101
this.error("method must return void", method);
102102
}
103103
final List<? extends VariableElement> parameters = method.getParameters();
104104
final DeclaredType eventType;
105105
if (parameters.isEmpty() || !this.isTypeSubclass(parameters.get(0), ListenerProcessor.EVENT_CLASS)) {
106-
this.error( "method must have an Event as its first parameter", method);
106+
this.error("method must have an Event as its first parameter", method);
107107
eventType = null;
108108
} else {
109109
eventType = (DeclaredType) parameters.get(0).asType();

src/ap/java/org/spongepowered/plugin/processor/ParameterContext.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
1+
/*
2+
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
125
package org.spongepowered.plugin.processor;
226

327
import org.checkerframework.checker.nullness.qual.Nullable;
428

529
import java.util.Objects;
630
import java.util.Optional;
7-
831
import javax.annotation.processing.ProcessingEnvironment;
932
import javax.lang.model.element.AnnotationMirror;
1033
import javax.lang.model.element.AnnotationValue;

src/ap/java/org/spongepowered/plugin/processor/ProcessorUtils.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828

2929
import java.util.Collection;
3030
import java.util.List;
31-
3231
import javax.lang.model.element.Element;
3332
import javax.lang.model.element.ElementKind;
3433
import javax.lang.model.element.TypeElement;

0 commit comments

Comments
 (0)