chore: make code style consistent
This commit is contained in:
parent
a2cea2f33e
commit
89ec3fbf29
380 changed files with 479 additions and 936 deletions
|
|
@ -214,7 +214,7 @@ public final class AnnotationParser<C> {
|
|||
* custom command method execution strategies.
|
||||
*
|
||||
* @param predicate The predicate that decides whether or not to apply the custom execution handler to the given method
|
||||
* @param function The function that produces the command execution handler
|
||||
* @param function The function that produces the command execution handler
|
||||
* @since 1.6.0
|
||||
*/
|
||||
public void registerCommandExecutionMethodFactory(
|
||||
|
|
@ -331,8 +331,8 @@ public final class AnnotationParser<C> {
|
|||
*
|
||||
* @return Collection of parsed commands
|
||||
* @throws Exception re-throws all encountered exceptions.
|
||||
* @since 1.7.0
|
||||
* @see cloud.commandframework.annotations.processing.CommandContainer CommandContainer for more information.
|
||||
* @since 1.7.0
|
||||
*/
|
||||
public @NonNull Collection<@NonNull Command<C>> parseContainers() throws Exception {
|
||||
final List<Command<C>> commands = new LinkedList<>();
|
||||
|
|
@ -600,11 +600,11 @@ public final class AnnotationParser<C> {
|
|||
try {
|
||||
final MethodCommandExecutionHandler.CommandMethodContext<C> context =
|
||||
new MethodCommandExecutionHandler.CommandMethodContext<>(
|
||||
instance,
|
||||
commandArguments,
|
||||
method,
|
||||
this /* annotationParser */
|
||||
);
|
||||
instance,
|
||||
commandArguments,
|
||||
method,
|
||||
this /* annotationParser */
|
||||
);
|
||||
|
||||
/* Create the command execution handler */
|
||||
CommandExecutionHandler<C> commandExecutionHandler = new MethodCommandExecutionHandler<>(context);
|
||||
|
|
@ -635,8 +635,9 @@ public final class AnnotationParser<C> {
|
|||
/* Apply builder modifiers */
|
||||
for (final Annotation annotation
|
||||
: AnnotationAccessor.of(classAnnotations, AnnotationAccessor.of(method)).annotations()) {
|
||||
@SuppressWarnings("rawtypes")
|
||||
final BiFunction builderModifier = this.builderModifiers.get(annotation.annotationType());
|
||||
@SuppressWarnings("rawtypes") final BiFunction builderModifier = this.builderModifiers.get(
|
||||
annotation.annotationType()
|
||||
);
|
||||
if (builderModifier == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -774,5 +775,4 @@ public final class AnnotationParser<C> {
|
|||
@NonNull Function<@NonNull ? extends Annotation, @NonNull ParserParameters>> getAnnotationMappers() {
|
||||
return this.annotationMappers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public @interface Argument {
|
|||
* The name of the argument that this parameter is bound to.
|
||||
* This value must be overridden unless you have explicitly enabled
|
||||
* the preservation of parameter names in your compiler options.
|
||||
*
|
||||
* <p>
|
||||
* If the parameter names are preserved and the name of the bound
|
||||
* argument is the same as the parameter name, the default value
|
||||
* may be used.
|
||||
|
|
@ -86,5 +86,4 @@ public @interface Argument {
|
|||
* @return Argument description
|
||||
*/
|
||||
@NonNull String description() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,5 +47,4 @@ class ArgumentExtractor implements Function<@NonNull Method, @NonNull Collection
|
|||
}
|
||||
return arguments;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,5 +54,4 @@ final class ArgumentParameterPair {
|
|||
return this.argument.value();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,5 +43,4 @@ public @interface CommandDescription {
|
|||
* @return Command syntax
|
||||
*/
|
||||
@NonNull String value() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface CommandMethod {
|
||||
|
||||
String ANNOTATION_PATH = "cloud.commandframework.annotations.CommandMethod";
|
||||
|
||||
/**
|
||||
|
|
@ -50,5 +51,4 @@ public @interface CommandMethod {
|
|||
* @return Required sender
|
||||
*/
|
||||
@NonNull Class<?> requiredSender() default Object.class;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,5 +46,4 @@ final class CommandMethodPair {
|
|||
@NonNull CommandMethod getCommandMethod() {
|
||||
return this.commandMethod;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,5 +42,4 @@ public @interface CommandPermission {
|
|||
* @return Command permission
|
||||
*/
|
||||
@NonNull String value() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,5 +94,4 @@ public @interface Flag {
|
|||
* @since 1.6.0
|
||||
*/
|
||||
@NonNull String permission() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,5 +116,4 @@ final class FlagExtractor implements Function<@NonNull Method, Collection<@NonNu
|
|||
}
|
||||
return flags;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,5 +55,4 @@ class MetaFactory implements Function<@NonNull Method, @NonNull CommandMeta> {
|
|||
});
|
||||
return this.metaMapper.apply(parameters);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,5 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
|
|||
public @NonNull AnnotationParser<C> annotationParser() {
|
||||
return this.annotationParser;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,5 +51,4 @@ public @interface ProxiedBy {
|
|||
* @return {@code true} if the proxying command should be hidden, {@code false} if not
|
||||
*/
|
||||
boolean hidden() default false;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,5 +52,4 @@ public @interface Regex {
|
|||
* @return Failure caption key
|
||||
*/
|
||||
@NonNull String failureCaption() default "argument.parse.failure.regex";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,5 +75,4 @@ public final class SyntaxFragment {
|
|||
public @NonNull ArgumentMode getArgumentMode() {
|
||||
return this.argumentMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,5 +85,4 @@ public final class MethodArgumentParser<C, T> implements ArgumentParser<C, T> {
|
|||
) {
|
||||
return this.suggestionProvider.apply(commandContext, input);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,5 +66,4 @@ public @interface Parser {
|
|||
* @return The name of the suggestion provider, or {@code ""}
|
||||
*/
|
||||
String suggestions() default "";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,6 +51,6 @@ import java.lang.annotation.Target;
|
|||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CommandContainer {
|
||||
String ANNOTATION_PATH = "cloud.commandframework.annotations.processing.CommandContainer";
|
||||
|
||||
String ANNOTATION_PATH = "cloud.commandframework.annotations.processing.CommandContainer";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,5 +64,4 @@ public final class MethodSuggestionsProvider<C> implements BiFunction<CommandCon
|
|||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,5 +48,4 @@ public @interface Suggestions {
|
|||
* @return Suggestions provider name
|
||||
*/
|
||||
@NonNull String value();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,6 @@ class AnnotationParserTest {
|
|||
public void annotatedMethod() {
|
||||
System.out.println("kekw");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@CommandPermission("some.permission")
|
||||
|
|
@ -292,7 +291,6 @@ class AnnotationParserTest {
|
|||
@AnnotatedAnnotation
|
||||
public static void annotatedMethod() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -324,7 +322,6 @@ class AnnotationParserTest {
|
|||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -340,7 +337,6 @@ class AnnotationParserTest {
|
|||
public String toString() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -354,7 +350,6 @@ class AnnotationParserTest {
|
|||
* @return Integer argument name
|
||||
*/
|
||||
String value() default "number";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -373,7 +368,5 @@ class AnnotationParserTest {
|
|||
@CommandMethod(COMMAND_ALIASES + " sub2")
|
||||
public void commandThree() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,12 @@ class NoOpStringProcessorTest {
|
|||
for (int i = 0; i < 10; i++) {
|
||||
// Arrange
|
||||
final StringProcessor stringProcessor = StringProcessor.noOp();
|
||||
final String input = ThreadLocalRandom.current().ints().mapToObj(Integer::toString).limit(32).collect(Collectors.joining());
|
||||
final String input = ThreadLocalRandom
|
||||
.current()
|
||||
.ints()
|
||||
.mapToObj(Integer::toString)
|
||||
.limit(32)
|
||||
.collect(Collectors.joining());
|
||||
|
||||
// Act
|
||||
final String output = stringProcessor.processString(input);
|
||||
|
|
|
|||
|
|
@ -46,5 +46,4 @@ public class TestCommandManager extends CommandManager<TestCommandSender> {
|
|||
) {
|
||||
return !permission.equalsIgnoreCase("no");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,6 @@ import cloud.commandframework.meta.CommandMeta;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.util.stream.Collectors;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,9 @@ public class CommandMethodProcessorTest {
|
|||
|
||||
// Assert
|
||||
assertThat(compilation).failed();
|
||||
assertThat(compilation).hadErrorContaining("Required argument 'required' cannot succeed an optional argument (commandMethod)");
|
||||
assertThat(compilation).hadErrorContaining(
|
||||
"Required argument 'required' cannot succeed an optional argument (commandMethod)"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue