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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -52,7 +52,7 @@ dependencies {
runtime 'net.java.dev.jna:jna:4.5.2' // Needed for JLine runtime 'net.java.dev.jna:jna:4.5.2' // Needed for JLine
runtime 'com.lmax:disruptor:3.4.2' // Async loggers 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 'net.kyori:event-method-asm:3.0.0'
compile 'com.mojang:brigadier:1.0.15' 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<>(); private final Map<String, Command> commands = new HashMap<>();
@Override @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(aliases, "aliases");
Preconditions.checkNotNull(command, "executor"); Preconditions.checkNotNull(command, "executor");
for (int i = 0, length = aliases.length; i < length; i++) { for (int i = 0, length = aliases.length; i < length; i++) {
@ -31,13 +31,13 @@ public class VelocityCommandManager implements CommandManager {
} }
@Override @Override
public void unregister(@NonNull final String alias) { public void unregister(final String alias) {
Preconditions.checkNotNull(alias, "name"); Preconditions.checkNotNull(alias, "name");
this.commands.remove(alias.toLowerCase(Locale.ENGLISH)); this.commands.remove(alias.toLowerCase(Locale.ENGLISH));
} }
@Override @Override
public boolean execute(@NonNull CommandSource source, @NonNull String cmdLine) { public boolean execute(CommandSource source, String cmdLine) {
Preconditions.checkNotNull(source, "invoker"); Preconditions.checkNotNull(source, "invoker");
Preconditions.checkNotNull(cmdLine, "cmdLine"); Preconditions.checkNotNull(cmdLine, "cmdLine");

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -75,8 +75,7 @@ public class PlayerListItem implements MinecraftPacket {
} }
} }
@Nullable private static @Nullable Component readOptionalComponent(ByteBuf buf) {
private static Component readOptionalComponent(ByteBuf buf) {
if (buf.readBoolean()) { if (buf.readBoolean()) {
return ComponentSerializers.JSON.deserialize(ProtocolUtils.readString(buf)); 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 { public class ResourcePackRequest implements MinecraftPacket {
@MonotonicNonNull private @MonotonicNonNull String url;
private String url; private @MonotonicNonNull String hash;
@MonotonicNonNull
private String hash;
@Nullable public @Nullable String getUrl() {
public String getUrl() {
return url; return url;
} }
@ -25,8 +22,7 @@ public class ResourcePackRequest implements MinecraftPacket {
this.url = url; this.url = url;
} }
@Nullable public @Nullable String getHash() {
public String getHash() {
return hash; return hash;
} }

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -1,7 +1,6 @@
package com.velocitypowered.proxy.protocol.packet.brigadier; package com.velocitypowered.proxy.protocol.packet.brigadier;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class ByteArgumentPropertySerializer implements ArgumentPropertySerializer<Byte> { class ByteArgumentPropertySerializer implements ArgumentPropertySerializer<Byte> {
@ -11,7 +10,6 @@ class ByteArgumentPropertySerializer implements ArgumentPropertySerializer<Byte>
} }
@Nullable
@Override @Override
public Byte deserialize(ByteBuf buf) { public Byte deserialize(ByteBuf buf) {
return buf.readByte(); 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 com.mojang.brigadier.arguments.DoubleArgumentType;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<DoubleArgumentType> { class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<DoubleArgumentType> {
@ -15,7 +14,6 @@ class DoubleArgumentPropertySerializer implements ArgumentPropertySerializer<Dou
private DoubleArgumentPropertySerializer() { private DoubleArgumentPropertySerializer() {
} }
@Nullable
@Override @Override
public DoubleArgumentType deserialize(ByteBuf buf) { public DoubleArgumentType deserialize(ByteBuf buf) {
byte flags = buf.readByte(); byte flags = buf.readByte();

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -2,7 +2,6 @@ package com.velocitypowered.proxy.protocol.packet.brigadier;
import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
class IntegerArgumentPropertySerializer implements ArgumentPropertySerializer<IntegerArgumentType> { class IntegerArgumentPropertySerializer implements ArgumentPropertySerializer<IntegerArgumentType> {
@ -15,7 +14,6 @@ class IntegerArgumentPropertySerializer implements ArgumentPropertySerializer<In
} }
@Nullable
@Override @Override
public IntegerArgumentType deserialize(ByteBuf buf) { public IntegerArgumentType deserialize(ByteBuf buf) {
byte flags = buf.readByte(); 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.mojang.brigadier.arguments.StringArgumentType;
import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.ProtocolUtils;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import org.checkerframework.checker.nullness.qual.Nullable;
/** /**
* Serializes properties for {@link StringArgumentType}. * Serializes properties for {@link StringArgumentType}.
@ -17,7 +16,6 @@ class StringArgumentPropertySerializer implements ArgumentPropertySerializer<Str
} }
@Nullable
@Override @Override
public StringArgumentType deserialize(ByteBuf buf) { public StringArgumentType deserialize(ByteBuf buf) {
int type = ProtocolUtils.readVarInt(buf); int type = ProtocolUtils.readVarInt(buf);

Datei anzeigen

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