build: update build-time dependencies, address new warnings (#413)

* build: update build-time dependencies, address new warnings

* build: switch to central repo declaration, remove redundant repositories

* build: use spotless predeclaration, more task avoidance on kotlin modules
This commit is contained in:
zml 2022-12-08 20:40:52 -08:00 committed by Jason
parent 86b76b91c7
commit 59c5a8310c
33 changed files with 204 additions and 135 deletions

View file

@ -478,7 +478,7 @@ public class CommandArgument<C, T> implements Comparable<CommandArgument<?, ?>>,
public final int compareTo(final @NonNull CommandArgument<?, ?> o) {
if (this instanceof StaticArgument) {
if (o instanceof StaticArgument) {
return (this.getName().compareTo(o.getName()));
return this.getName().compareTo(o.getName());
} else {
return -1;
}

View file

@ -258,7 +258,7 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
return strings;
} else {
CommandFlag<?> currentFlag = null;
if (lastArg.startsWith("--")) {
if (lastArg.startsWith("--")) { // --long
final String flagName = lastArg.substring(2);
for (final CommandFlag<?> flag : this.flags) {
if (flagName.equalsIgnoreCase(flag.getName())) {
@ -266,7 +266,7 @@ public final class FlagArgument<C> extends CommandArgument<C, Object> {
break;
}
}
} else if (lastArg.startsWith("-")) {
} else { // -x
final String flagName = lastArg.substring(1);
for (final CommandFlag<?> flag : this.flags) {
for (final String alias : flag.getAliases()) {

View file

@ -107,12 +107,11 @@ public final class FlagContext {
* Returns the number of values associated with the given {@code flag}.
*
* @param flag the flag
* @param <T> the flag value type
* @return the number of values associated with the flag
* @since 1.7.0
*/
@API(status = API.Status.STABLE, since = "1.7.0")
public <T> int count(final @NonNull String flag) {
public int count(final @NonNull String flag) {
return this.getAll(flag).size();
}

View file

@ -97,7 +97,7 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
*/
public StandardParserRegistry() {
/* Register standard mappers */
this.<Range, Number>registerAnnotationMapper(Range.class, new RangeMapper<>());
this.<Range, Number>registerAnnotationMapper(Range.class, new RangeMapper());
this.<Greedy, String>registerAnnotationMapper(Greedy.class, new GreedyMapper());
this.<Quoted, String>registerAnnotationMapper(
Quoted.class,
@ -291,7 +291,7 @@ public final class StandardParserRegistry<C> implements ParserRegistry<C> {
}
private static final class RangeMapper<T> implements BiFunction<@NonNull Range, @NonNull TypeToken<?>,
private static final class RangeMapper implements BiFunction<@NonNull Range, @NonNull TypeToken<?>,
@NonNull ParserParameters> {
@Override

View file

@ -52,6 +52,7 @@ public final class TestUtils {
private abstract static class TestCommandSenderCommandManager extends CommandManager<TestCommandSender> {
@SuppressWarnings("unused") // mocked via mockito
protected TestCommandSenderCommandManager(
final @NonNull Function<@NonNull CommandTree<TestCommandSender>, @NonNull CommandExecutionCoordinator<TestCommandSender>> commandExecutionCoordinator,
final @NonNull CommandRegistrationHandler commandRegistrationHandler