all: update to error prone 2.3.3

This commit is contained in:
Carl Mastrangelo 2019-06-05 15:28:43 -07:00 committed by GitHub
parent 16de96befe
commit 7657523b28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 44 additions and 37 deletions

View File

@ -136,7 +136,7 @@ class AltsHandshakerClient {
throw new IllegalStateException("Could not get enough key data from the handshake.");
}
byte[] key = new byte[KEY_LENGTH];
result.getKeyData().copyTo(key, 0, 0, KEY_LENGTH);
result.getKeyData().copyTo(key, 0);
return key;
}

View File

@ -27,7 +27,6 @@ import io.grpc.Attributes;
import io.grpc.Channel;
import io.grpc.Grpc;
import io.grpc.InternalChannelz;
import io.grpc.InternalChannelz.Security;
import io.grpc.ManagedChannel;
import io.grpc.SecurityLevel;
import io.grpc.alts.internal.AltsProtocolNegotiator.LazyChannel;
@ -396,7 +395,6 @@ public class AltsProtocolNegotiatorTest {
private final class CapturingGrpcHttp2ConnectionHandler extends GrpcHttp2ConnectionHandler {
private Attributes attrs;
private Security securityInfo;
private CapturingGrpcHttp2ConnectionHandler(
Http2ConnectionDecoder decoder,
@ -407,11 +405,11 @@ public class AltsProtocolNegotiatorTest {
@Override
public void handleProtocolNegotiationCompleted(
Attributes attrs, InternalChannelz.Security securityInfo) {
Attributes attrs,
@SuppressWarnings("UnusedVariable") InternalChannelz.Security securityInfo) {
// If we are added to the pipeline, we need to remove ourselves. The HTTP2 handler
channel.pipeline().remove(this);
this.attrs = attrs;
this.securityInfo = securityInfo;
}
}

View File

@ -43,7 +43,7 @@ repositories {
}
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
implementation 'io.grpc:grpc-core:1.22.0-SNAPSHOT' // CURRENT_GRPC_VERSION

View File

@ -6,7 +6,7 @@ dependencies {
libraries.jsr305,
libraries.animalsniffer_annotations
compile (libraries.guava) {
// prefer 2.3.2 from libraries instead of 2.1.3
// prefer 2.3.3 from libraries instead of 2.1.3
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
// prefer 3.0.2 from libraries instead of 3.0.1
exclude group: 'com.google.code.findbugs', module: 'jsr305'

View File

@ -125,7 +125,7 @@ public class ServiceProvidersTest {
ClassLoader cl = new ReplacingClassLoader(getClass().getClassLoader(), serviceFile,
"io/grpc/ServiceProvidersTestAbstractProvider-unknownClassProvider.txt");
try {
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
ServiceProviders.load(
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
fail("Exception expected");
} catch (ServiceConfigurationError e) {
@ -140,7 +140,7 @@ public class ServiceProvidersTest {
try {
// Even though there is a working provider, if any providers fail then we should fail
// completely to avoid returning something unexpected.
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
ServiceProviders.load(
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
fail("Expected exception");
} catch (ServiceConfigurationError expected) {
@ -154,7 +154,7 @@ public class ServiceProvidersTest {
"io/grpc/ServiceProvidersTestAbstractProvider-failAtPriorityProvider.txt");
try {
// The exception should be surfaced to the caller
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
ServiceProviders.load(
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
fail("Expected exception");
} catch (FailAtPriorityProvider.PriorityException expected) {
@ -168,7 +168,7 @@ public class ServiceProvidersTest {
"io/grpc/ServiceProvidersTestAbstractProvider-failAtAvailableProvider.txt");
try {
// The exception should be surfaced to the caller
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
ServiceProviders.load(
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
fail("Expected exception");
} catch (FailAtAvailableProvider.AvailableException expected) {
@ -193,10 +193,9 @@ public class ServiceProvidersTest {
@Test
public void getCandidatesViaHardCoded_failAtInit() throws Exception {
try {
Iterable<ServiceProvidersTestAbstractProvider> ignored =
ServiceProviders.getCandidatesViaHardCoded(
ServiceProvidersTestAbstractProvider.class,
Collections.<Class<?>>singletonList(FailAtInitProvider.class));
ServiceProviders.getCandidatesViaHardCoded(
ServiceProvidersTestAbstractProvider.class,
Collections.<Class<?>>singletonList(FailAtInitProvider.class));
fail("Expected exception");
} catch (ServiceConfigurationError expected) {
// noop
@ -206,10 +205,9 @@ public class ServiceProvidersTest {
@Test
public void getCandidatesViaHardCoded_failAtInit_moreCandidates() throws Exception {
try {
Iterable<ServiceProvidersTestAbstractProvider> ignored =
ServiceProviders.getCandidatesViaHardCoded(
ServiceProvidersTestAbstractProvider.class,
ImmutableList.<Class<?>>of(FailAtInitProvider.class, Available0Provider.class));
ServiceProviders.getCandidatesViaHardCoded(
ServiceProvidersTestAbstractProvider.class,
ImmutableList.<Class<?>>of(FailAtInitProvider.class, Available0Provider.class));
fail("Expected exception");
} catch (ServiceConfigurationError expected) {
// noop
@ -221,7 +219,7 @@ public class ServiceProvidersTest {
class PrivateClass {}
try {
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.create(
ServiceProviders.create(
ServiceProvidersTestAbstractProvider.class, PrivateClass.class);
fail("Expected exception");
} catch (ServiceConfigurationError expected) {

View File

@ -31,7 +31,7 @@ subprojects {
apply plugin: "net.ltgt.errorprone"
if (rootProject.properties.get('errorProne', true)) {
dependencies {
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
annotationProcessor 'com.google.guava:guava-beta-checker:1.0'

View File

@ -967,7 +967,7 @@ public class ContextTest {
assertNull(logRef.get());
ctx = ctx.fork();
}
ctx = ctx.fork();
ctx.fork();
assertNotNull(logRef.get());
assertNotNull(logRef.get().getThrown());
assertEquals(Level.SEVERE, logRef.get().getLevel());

View File

@ -55,7 +55,6 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import javax.annotation.concurrent.ThreadSafe;
@ -64,7 +63,6 @@ import javax.annotation.concurrent.ThreadSafe;
*/
@ThreadSafe
final class InternalSubchannel implements InternalInstrumented<ChannelStats>, TransportProvider {
private static final Logger log = Logger.getLogger(InternalSubchannel.class.getName());
private final InternalLogId logId;
private final String authority;

View File

@ -254,6 +254,7 @@ final class ManagedChannelImpl extends ManagedChannel implements
// Must be mutated and read from constructor or syncContext
// See service config error handling spec for reference.
// TODO(notcarl): check this value when error in service config resolution
@SuppressWarnings("UnusedVariable")
private boolean waitingForServiceConfig = true;
private final boolean lookUpServiceConfig;

View File

@ -45,6 +45,7 @@ final class ManagedChannelServiceConfig {
private final Map<String, MethodInfo> serviceMap;
// TODO(notcarl/zdapeng): use retryThrottling here
@Nullable
@SuppressWarnings("unused")
private final Throttle retryThrottling;
@Nullable
private final Object loadBalancingConfig;

View File

@ -54,6 +54,7 @@ public final class ManagedChannelOrphanWrapperTest {
new ConcurrentHashMap<>();
assertEquals(0, refs.size());
@SuppressWarnings("UnusedVariable")
ManagedChannelOrphanWrapper channel = new ManagedChannelOrphanWrapper(mc, refqueue, refs);
assertEquals(1, refs.size());
@ -106,8 +107,11 @@ public final class ManagedChannelOrphanWrapperTest {
new ReferenceQueue<>();
ConcurrentMap<ManagedChannelReference, ManagedChannelReference> refs =
new ConcurrentHashMap<>();
@SuppressWarnings("UnusedVariable")
ApplicationWithChannelRef app = new ApplicationWithChannelRef();
@SuppressWarnings("UnusedVariable")
ChannelWithApplicationRef channelImpl = new ChannelWithApplicationRef();
@SuppressWarnings("UnusedVariable")
ManagedChannelOrphanWrapper channel =
new ManagedChannelOrphanWrapper(channelImpl, refqueue, refs);
app.channel = channel;
@ -164,10 +168,12 @@ public final class ManagedChannelOrphanWrapperTest {
}
private static final class ApplicationWithChannelRef {
@SuppressWarnings("UnusedVariable")
private ManagedChannel channel;
}
private static final class ChannelWithApplicationRef extends TestManagedChannel {
@SuppressWarnings("UnusedVariable")
private ApplicationWithChannelRef application;
}
}

View File

@ -80,7 +80,7 @@ public final class NettyClientInteropServlet extends HttpServlet {
LogEntryRecorder handler = new LogEntryRecorder();
Logger.getLogger("").addHandler(handler);
try {
doGetHelper(req, resp);
doGetHelper(resp);
} finally {
Logger.getLogger("").removeHandler(handler);
}
@ -89,7 +89,7 @@ public final class NettyClientInteropServlet extends HttpServlet {
.append(handler.getLogOutput());
}
private void doGetHelper(HttpServletRequest req, HttpServletResponse resp) throws IOException {
private void doGetHelper(HttpServletResponse resp) throws IOException {
resp.setContentType("text/plain");
PrintWriter writer = resp.getWriter();
writer.println("Test invoked at: ");

View File

@ -72,6 +72,7 @@ final class JettyTlsUtil {
static synchronized Throwable getJettyAlpnUnavailabilityCause() {
// This case should be unlikely
if (jettyAlpnUnavailabilityCause == null) {
@SuppressWarnings("UnusedVariable")
boolean discard = isJettyAlpnConfigured();
}
return jettyAlpnUnavailabilityCause;
@ -93,6 +94,7 @@ final class JettyTlsUtil {
static synchronized Throwable getJettyNpnUnavailabilityCause() {
// This case should be unlikely
if (jettyNpnUnavailabilityCause == null) {
@SuppressWarnings("UnusedVariable")
boolean discard = isJettyNpnConfigured();
}
return jettyNpnUnavailabilityCause;

View File

@ -366,6 +366,7 @@ public enum CipherSuite {
* @param sinceJavaVersion the first major Java release supporting this cipher suite.
* @param sinceAndroidVersion the first Android SDK version supporting this cipher suite.
*/
@SuppressWarnings("UnusedVariable")
private CipherSuite(
String javaName, int value, int rfc, int sinceJavaVersion, int sinceAndroidVersion) {
this.javaName = javaName;

View File

@ -120,6 +120,7 @@ public final class OkHostnameVerifier implements HostnameVerifier {
return false;
}
@SuppressWarnings("MixedMutabilityReturnType")
public static List<String> allSubjectAltNames(X509Certificate certificate) {
List<String> altIpaNames = getSubjectAltNames(certificate, ALT_IPA_NAME);
List<String> altDnsNames = getSubjectAltNames(certificate, ALT_DNS_NAME);
@ -129,6 +130,7 @@ public final class OkHostnameVerifier implements HostnameVerifier {
return result;
}
@SuppressWarnings("MixedMutabilityReturnType")
private static List<String> getSubjectAltNames(X509Certificate certificate, int type) {
List<String> result = new ArrayList<>();
try {

View File

@ -234,7 +234,8 @@ public final class Http2 implements Variant {
source.skip(padding);
}
private void readPriority(Handler handler, int length, byte flags, int streamId)
private void readPriority(
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
throws IOException {
if (length != 5) throw ioException("TYPE_PRIORITY length: %d != 5", length);
if (streamId == 0) throw ioException("TYPE_PRIORITY streamId == 0");
@ -249,7 +250,8 @@ public final class Http2 implements Variant {
handler.priority(streamId, streamDependency, weight, exclusive);
}
private void readRstStream(Handler handler, int length, byte flags, int streamId)
private void readRstStream(
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
throws IOException {
if (length != 4) throw ioException("TYPE_RST_STREAM length: %d != 4", length);
if (streamId == 0) throw ioException("TYPE_RST_STREAM streamId == 0");
@ -335,7 +337,8 @@ public final class Http2 implements Variant {
handler.ping(ack, payload1, payload2);
}
private void readGoAway(Handler handler, int length, byte flags, int streamId)
private void readGoAway(
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
throws IOException {
if (length < 8) throw ioException("TYPE_GOAWAY length < 8: %s", length);
if (streamId != 0) throw ioException("TYPE_GOAWAY streamId != 0");
@ -353,7 +356,8 @@ public final class Http2 implements Variant {
handler.goAway(lastStreamId, errorCode, debugData);
}
private void readWindowUpdate(Handler handler, int length, byte flags, int streamId)
private void readWindowUpdate(
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
throws IOException {
if (length != 4) throw ioException("TYPE_WINDOW_UPDATE length !=4: %s", length);
long increment = (source.readInt() & 0x7fffffffL);

View File

@ -15,7 +15,7 @@ dependencies {
compile project(':grpc-api'),
libraries.protobuf_lite
compile (libraries.guava) {
// prefer 2.3.2 from libraries instead of 2.1.3
// prefer 2.3.3 from libraries instead of 2.1.3
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
// prefer 3.0.2 from libraries instead of 3.0.1
exclude group: 'com.google.code.findbugs', module: 'jsr305'

View File

@ -196,9 +196,9 @@ def com_google_code_gson():
def com_google_errorprone_error_prone_annotations():
jvm_maven_import_external(
name = "com_google_errorprone_error_prone_annotations",
artifact = "com.google.errorprone:error_prone_annotations:2.3.2",
artifact = "com.google.errorprone:error_prone_annotations:2.3.3",
server_urls = ["http://central.maven.org/maven2"],
artifact_sha256 = "357cd6cfb067c969226c442451502aee13800a24e950fdfde77bcdb4565a668d",
artifact_sha256 = "ec59f1b702d9afc09e8c3929f5c42777dec623a6ea2731ac694332c7d7680f5a",
licenses = ["notice"], # Apache 2.0
)

View File

@ -532,8 +532,6 @@ public class ServerCallsTest {
private final MethodDescriptor<Integer, Integer> methodDescriptor;
private final List<Integer> requestCalls = new ArrayList<>();
private final List<Integer> responses = new ArrayList<>();
private Metadata headers;
private Metadata trailers;
private Status status;
private boolean isCancelled;
private boolean isReady;
@ -549,7 +547,6 @@ public class ServerCallsTest {
@Override
public void sendHeaders(Metadata headers) {
this.headers = headers;
}
@Override
@ -560,7 +557,6 @@ public class ServerCallsTest {
@Override
public void close(Status status, Metadata trailers) {
this.status = status;
this.trailers = trailers;
}
@Override