chore: make code style consistent

This commit is contained in:
Citymonstret 2022-06-10 10:24:50 +02:00 committed by Jason
parent a2cea2f33e
commit 89ec3fbf29
380 changed files with 479 additions and 936 deletions

View file

@ -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;
}
}

View file

@ -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 "";
}

View file

@ -47,5 +47,4 @@ class ArgumentExtractor implements Function<@NonNull Method, @NonNull Collection
}
return arguments;
}
}

View file

@ -54,5 +54,4 @@ final class ArgumentParameterPair {
return this.argument.value();
}
}
}

View file

@ -43,5 +43,4 @@ public @interface CommandDescription {
* @return Command syntax
*/
@NonNull String value() default "";
}

View file

@ -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;
}

View file

@ -46,5 +46,4 @@ final class CommandMethodPair {
@NonNull CommandMethod getCommandMethod() {
return this.commandMethod;
}
}

View file

@ -42,5 +42,4 @@ public @interface CommandPermission {
* @return Command permission
*/
@NonNull String value() default "";
}

View file

@ -94,5 +94,4 @@ public @interface Flag {
* @since 1.6.0
*/
@NonNull String permission() default "";
}

View file

@ -116,5 +116,4 @@ final class FlagExtractor implements Function<@NonNull Method, Collection<@NonNu
}
return flags;
}
}

View file

@ -55,5 +55,4 @@ class MetaFactory implements Function<@NonNull Method, @NonNull CommandMeta> {
});
return this.metaMapper.apply(parameters);
}
}

View file

@ -273,7 +273,5 @@ public class MethodCommandExecutionHandler<C> implements CommandExecutionHandler
public @NonNull AnnotationParser<C> annotationParser() {
return this.annotationParser;
}
}
}

View file

@ -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;
}

View file

@ -52,5 +52,4 @@ public @interface Regex {
* @return Failure caption key
*/
@NonNull String failureCaption() default "argument.parse.failure.regex";
}

View file

@ -75,5 +75,4 @@ public final class SyntaxFragment {
public @NonNull ArgumentMode getArgumentMode() {
return this.argumentMode;
}
}

View file

@ -85,5 +85,4 @@ public final class MethodArgumentParser<C, T> implements ArgumentParser<C, T> {
) {
return this.suggestionProvider.apply(commandContext, input);
}
}

View file

@ -66,5 +66,4 @@ public @interface Parser {
* @return The name of the suggestion provider, or {@code ""}
*/
String suggestions() default "";
}

View file

@ -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";
}

View file

@ -64,5 +64,4 @@ public final class MethodSuggestionsProvider<C> implements BiFunction<CommandCon
throw new RuntimeException(t);
}
}
}

View file

@ -48,5 +48,4 @@ public @interface Suggestions {
* @return Suggestions provider name
*/
@NonNull String value();
}

View file

@ -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() {
}
}
}

View file

@ -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);

View file

@ -46,5 +46,4 @@ public class TestCommandManager extends CommandManager<TestCommandSender> {
) {
return !permission.equalsIgnoreCase("no");
}
}

View file

@ -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;

View file

@ -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