13
0
geforkt von Mirrors/Velocity

Updated log4j and Checker Framework

Updating Checker Framework flagged numerous warnings, which have been
corrected. These probably involve type declarations lacking a nullness
annotation that appeared elsewhere.
Dieser Commit ist enthalten in:
Andrew Steinborn 2019-03-28 22:27:51 -04:00
Ursprung 9491f948f8
Commit 118574e535
24 geänderte Dateien mit 35 neuen und 80 gelöschten Zeilen

Datei anzeigen

@ -3,7 +3,6 @@ package com.velocitypowered.api.event.query;
import com.google.common.base.Preconditions;
import com.velocitypowered.api.proxy.server.QueryResponse;
import java.net.InetAddress;
import org.checkerframework.checker.nullness.qual.NonNull;
/**
* This event is fired if proxy is getting queried over GS4 Query protocol.
@ -32,7 +31,6 @@ public final class ProxyQueryEvent {
*
* @return query type
*/
@NonNull
public QueryType getQueryType() {
return queryType;
}
@ -42,7 +40,6 @@ public final class ProxyQueryEvent {
*
* @return querier address
*/
@NonNull
public InetAddress getQuerierAddress() {
return querierAddress;
}
@ -52,7 +49,6 @@ public final class ProxyQueryEvent {
*
* @return the current query response
*/
@NonNull
public QueryResponse getResponse() {
return response;
}
@ -62,7 +58,7 @@ public final class ProxyQueryEvent {
*
* @param response the new non-null query response
*/
public void setResponse(@NonNull QueryResponse response) {
public void setResponse(QueryResponse response) {
this.response = Preconditions.checkNotNull(response, "response");
}

Datei anzeigen

@ -14,8 +14,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public final class PluginDependency {
private final String id;
@Nullable
private final String version;
private final @Nullable String version;
private final boolean optional;

Datei anzeigen

@ -219,21 +219,11 @@ public final class QueryResponse {
* A builder for {@link QueryResponse} objects.
*/
public static final class Builder {
@MonotonicNonNull
private String hostname;
@MonotonicNonNull
private String gameVersion;
@MonotonicNonNull
private String map;
@MonotonicNonNull
private String proxyHost;
@MonotonicNonNull
private String proxyVersion;
private @MonotonicNonNull String hostname;
private @MonotonicNonNull String gameVersion;
private @MonotonicNonNull String map;
private @MonotonicNonNull String proxyHost;
private @MonotonicNonNull String proxyVersion;
private int currentPlayers;
private int maxPlayers;

Datei anzeigen

@ -22,10 +22,10 @@ allprojects {
// dependency versions
junitVersion = '5.3.0-M1'
slf4jVersion = '1.7.25'
log4jVersion = '2.11.1'
log4jVersion = '2.11.2'
nettyVersion = '4.1.34.Final'
guavaVersion = '25.1-jre'
checkerFrameworkVersion = '2.5.6'
checkerFrameworkVersion = '2.7.0'
getCurrentShortRevision = {
new ByteArrayOutputStream().withStream { os ->

Datei anzeigen

@ -52,7 +52,7 @@ dependencies {
runtime 'net.java.dev.jna:jna:4.5.2' // Needed for JLine
runtime 'com.lmax:disruptor:3.4.2' // Async loggers
compile 'it.unimi.dsi:fastutil:8.2.1'
compile 'it.unimi.dsi:fastutil:8.2.2'
compile 'net.kyori:event-method-asm:3.0.0'
compile 'com.mojang:brigadier:1.0.15'

Datei anzeigen

@ -20,7 +20,7 @@ public class VelocityCommandManager implements CommandManager {
private final Map<String, Command> commands = new HashMap<>();
@Override
public void register(@NonNull final Command command, final String... aliases) {
public void register(final Command command, final String... aliases) {
Preconditions.checkNotNull(aliases, "aliases");
Preconditions.checkNotNull(command, "executor");
for (int i = 0, length = aliases.length; i < length; i++) {
@ -31,13 +31,13 @@ public class VelocityCommandManager implements CommandManager {
}
@Override
public void unregister(@NonNull final String alias) {
public void unregister(final String alias) {
Preconditions.checkNotNull(alias, "name");
this.commands.remove(alias.toLowerCase(Locale.ENGLISH));
}
@Override
public boolean execute(@NonNull CommandSource source, @NonNull String cmdLine) {
public boolean execute(CommandSource source, String cmdLine) {
Preconditions.checkNotNull(source, "invoker");
Preconditions.checkNotNull(cmdLine, "cmdLine");

Datei anzeigen

@ -255,8 +255,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
}
}
@Nullable
public MinecraftSessionHandler getSessionHandler() {
public @Nullable MinecraftSessionHandler getSessionHandler() {
return sessionHandler;
}
@ -318,8 +317,7 @@ public class MinecraftConnection extends ChannelInboundHandlerAdapter {
.addBefore(FRAME_ENCODER, CIPHER_ENCODER, new MinecraftCipherEncoder(encryptionCipher));
}
@Nullable
public MinecraftConnectionAssociation getAssociation() {
public @Nullable MinecraftConnectionAssociation getAssociation() {
return association;
}

Datei anzeigen

@ -160,8 +160,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
mc.write(new ServerLogin(proxyPlayer.getUsername()));
}
@Nullable
public MinecraftConnection getConnection() {
public @Nullable MinecraftConnection getConnection() {
return connection;
}

Datei anzeigen

@ -86,8 +86,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
private final VelocityServer server;
private ClientConnectionPhase connectionPhase;
@MonotonicNonNull
private List<String> serversToTry = null;
private @MonotonicNonNull List<String> serversToTry = null;
ConnectedPlayer(VelocityServer server, GameProfile profile,
MinecraftConnection minecraftConnection, @Nullable InetSocketAddress virtualHost) {
@ -289,8 +288,7 @@ public class ConnectedPlayer implements MinecraftConnectionAssociation, Player {
}
@Nullable
public VelocityServerConnection getConnectedServer() {
public @Nullable VelocityServerConnection getConnectedServer() {
return connectedServer;
}

Datei anzeigen

@ -60,8 +60,8 @@ public class GS4QueryHandler extends SimpleChannelInboundHandler<DatagramPacket>
.expireAfterWrite(30, TimeUnit.SECONDS)
.build();
@MonotonicNonNull
private volatile List<QueryResponse.PluginInformation> pluginInformationList = null;
private volatile @MonotonicNonNull List<QueryResponse.PluginInformation> pluginInformationList
= null;
private final VelocityServer server;

Datei anzeigen

@ -45,8 +45,7 @@ public class AvailableCommands implements MinecraftPacket {
private static final byte FLAG_HAS_SUGGESTIONS = 0x10;
// Note: Velocity doesn't use Brigadier for command handling. This may change in Velocity 2.0.0.
@MonotonicNonNull
private RootCommandNode<Object> rootNode;
private @MonotonicNonNull RootCommandNode<Object> rootNode;
/**
* Returns the root node.
@ -206,10 +205,8 @@ public class AvailableCommands implements MinecraftPacket {
private final byte flags;
private final int[] children;
private final int redirectTo;
@Nullable
private final ArgumentBuilder<Object, ?> args;
@MonotonicNonNull
private CommandNode<Object> built;
private final @Nullable ArgumentBuilder<Object, ?> args;
private @MonotonicNonNull CommandNode<Object> built;
private WireNode(int idx, byte flags, int[] children, int redirectTo,
@Nullable ArgumentBuilder<Object, ?> args) {

Datei anzeigen

@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class LegacyPing implements MinecraftPacket {
private final LegacyMinecraftPingVersion version;
@Nullable
private final InetSocketAddress vhost;
private final @Nullable InetSocketAddress vhost;
public LegacyPing(LegacyMinecraftPingVersion version) {
this.version = version;
@ -29,8 +28,7 @@ public class LegacyPing implements MinecraftPacket {
return version;
}
@Nullable
public InetSocketAddress getVhost() {
public @Nullable InetSocketAddress getVhost() {
return vhost;
}

Datei anzeigen

@ -75,8 +75,7 @@ public class PlayerListItem implements MinecraftPacket {
}
}
@Nullable
private static Component readOptionalComponent(ByteBuf buf) {
private static @Nullable Component readOptionalComponent(ByteBuf buf) {
if (buf.readBoolean()) {
return ComponentSerializers.JSON.deserialize(ProtocolUtils.readString(buf));
}

Datei anzeigen

@ -11,13 +11,10 @@ import org.checkerframework.checker.nullness.qual.Nullable;
public class ResourcePackRequest implements MinecraftPacket {
@MonotonicNonNull
private String url;
@MonotonicNonNull
private String hash;
private @MonotonicNonNull String url;
private @MonotonicNonNull String hash;
@Nullable
public String getUrl() {
public @Nullable String getUrl() {
return url;
}
@ -25,8 +22,7 @@ public class ResourcePackRequest implements MinecraftPacket {
this.url = url;
}
@Nullable
public String getHash() {
public @Nullable String getHash() {
return hash;
}

Datei anzeigen

@ -12,8 +12,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
public class ResourcePackResponse implements MinecraftPacket {
private String hash = "";
@MonotonicNonNull
private Status status;
private @MonotonicNonNull Status status;
public Status getStatus() {
if (status == null) {

Datei anzeigen

@ -109,8 +109,7 @@ public class TabCompleteResponse implements MinecraftPacket {
public static class Offer implements Comparable<Offer> {
private final String text;
@Nullable
private final Component tooltip;
private final @Nullable Component tooltip;
public Offer(String text) {
this(text, null);

Datei anzeigen

@ -1,7 +1,6 @@
package com.velocitypowered.proxy.protocol.packet.brigadier;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class ByteArgumentPropertySerializer implements ArgumentPropertySerializer<Byte> {
@ -11,7 +10,6 @@ class ByteArgumentPropertySerializer implements ArgumentPropertySerializer<Byte>
}
@Nullable
@Override
public Byte deserialize(ByteBuf buf) {
return buf.readByte();

Datei anzeigen

@ -6,7 +6,6 @@ import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumen
import com.mojang.brigadier.arguments.DoubleArgumentType;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<DoubleArgumentType> {
@ -15,7 +14,6 @@ class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<Dou
private DoubleArgumentPropertySerializer() {
}
@Nullable
@Override
public DoubleArgumentType deserialize(ByteBuf buf) {
byte flags = buf.readByte();

Datei anzeigen

@ -9,8 +9,7 @@ class DummyProperty<T> implements ArgumentType<T> {
private final String identifier;
private final ArgumentPropertySerializer<T> serializer;
@Nullable
private final T result;
private final @Nullable T result;
DummyProperty(String identifier, ArgumentPropertySerializer<T> serializer, @Nullable T result) {
this.identifier = identifier;

Datei anzeigen

@ -14,9 +14,8 @@ class DummyVoidArgumentPropertySerializer implements ArgumentPropertySerializer<
private DummyVoidArgumentPropertySerializer() {
}
@Nullable
@Override
public Void deserialize(ByteBuf buf) {
public @Nullable Void deserialize(ByteBuf buf) {
return null;
}

Datei anzeigen

@ -6,7 +6,6 @@ import static com.velocitypowered.proxy.protocol.packet.brigadier.IntegerArgumen
import com.mojang.brigadier.arguments.FloatArgumentType;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class FloatArgumentPropertySerializer implements ArgumentPropertySerializer<FloatArgumentType> {
@ -16,7 +15,6 @@ class FloatArgumentPropertySerializer implements ArgumentPropertySerializer<Floa
}
@Nullable
@Override
public FloatArgumentType deserialize(ByteBuf buf) {
byte flags = buf.readByte();

Datei anzeigen

@ -2,7 +2,6 @@ package com.velocitypowered.proxy.protocol.packet.brigadier;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class IntegerArgumentPropertySerializer implements ArgumentPropertySerializer<IntegerArgumentType> {
@ -15,7 +14,6 @@ class IntegerArgumentPropertySerializer implements ArgumentPropertySerializer<In
}
@Nullable
@Override
public IntegerArgumentType deserialize(ByteBuf buf) {
byte flags = buf.readByte();

Datei anzeigen

@ -3,7 +3,6 @@ package com.velocitypowered.proxy.protocol.packet.brigadier;
import com.mojang.brigadier.arguments.StringArgumentType;
import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Serializes properties for {@link StringArgumentType}.
@ -17,7 +16,6 @@ class StringArgumentPropertySerializer implements ArgumentPropertySerializer<Str
}
@Nullable
@Override
public StringArgumentType deserialize(ByteBuf buf) {
int type = ProtocolUtils.readVarInt(buf);

Datei anzeigen

@ -19,9 +19,8 @@ class VoidArgumentPropertySerializer<T extends ArgumentType<?>>
return new VoidArgumentPropertySerializer<T>(supplier);
}
@Nullable
@Override
public T deserialize(ByteBuf buf) {
public @Nullable T deserialize(ByteBuf buf) {
return argumentSupplier.get();
}