Skip to content

Commit

Permalink
all: update to error prone 2.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
carl-mastrangelo authored Jun 5, 2019
1 parent 16de96b commit 7657523
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public byte[] getKey() {
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
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;
Expand Down Expand Up @@ -396,7 +395,6 @@ private CapturingGrpcHttp2ConnectionHandler capturingGrpcHandler() {
private final class CapturingGrpcHttp2ConnectionHandler extends GrpcHttp2ConnectionHandler {

private Attributes attrs;
private Security securityInfo;

private CapturingGrpcHttp2ConnectionHandler(
Http2ConnectionDecoder decoder,
Expand All @@ -407,11 +405,11 @@ private CapturingGrpcHttp2ConnectionHandler(

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

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
24 changes: 11 additions & 13 deletions api/src/test/java/io/grpc/ServiceProvidersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void unknownClassProvider() {
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) {
Expand All @@ -140,7 +140,7 @@ public void exceptionSurfacedToCaller_failAtInit() {
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) {
Expand All @@ -154,7 +154,7 @@ public void exceptionSurfacedToCaller_failAtPriority() {
"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) {
Expand All @@ -168,7 +168,7 @@ public void exceptionSurfacedToCaller_failAtAvailable() {
"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) {
Expand All @@ -193,10 +193,9 @@ public void getCandidatesViaHardCoded_multipleProvider() throws Exception {
@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
Expand All @@ -206,10 +205,9 @@ public void getCandidatesViaHardCoded_failAtInit() throws Exception {
@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
Expand All @@ -221,7 +219,7 @@ public void create_throwsErrorOnMisconfiguration() throws Exception {
class PrivateClass {}

try {
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.create(
ServiceProviders.create(
ServiceProvidersTestAbstractProvider.class, PrivateClass.class);
fail("Expected exception");
} catch (ServiceConfigurationError expected) {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion context/src/test/java/io/grpc/ContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ public void close() throws SecurityException {
assertNull(logRef.get());
ctx = ctx.fork();
}
ctx = ctx.fork();
ctx.fork();
assertNotNull(logRef.get());
assertNotNull(logRef.get().getThrown());
assertEquals(Level.SEVERE, logRef.get().getLevel());
Expand Down
2 changes: 0 additions & 2 deletions core/src/main/java/io/grpc/internal/InternalSubchannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
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;

Expand All @@ -64,7 +63,6 @@
*/
@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public void uncaughtException(Thread t, Throwable e) {
// 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void orphanedChannelsAreLogged() {
new ConcurrentHashMap<>();

assertEquals(0, refs.size());
@SuppressWarnings("UnusedVariable")
ManagedChannelOrphanWrapper channel = new ManagedChannelOrphanWrapper(mc, refqueue, refs);
assertEquals(1, refs.size());

Expand Down Expand Up @@ -106,8 +107,11 @@ public void refCycleIsGCed() {
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;
Expand Down Expand Up @@ -164,10 +168,12 @@ public String authority() {
}

private static final class ApplicationWithChannelRef {
@SuppressWarnings("UnusedVariable")
private ManagedChannel channel;
}

private static final class ChannelWithApplicationRef extends TestManagedChannel {
@SuppressWarnings("UnusedVariable")
private ApplicationWithChannelRef application;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
LogEntryRecorder handler = new LogEntryRecorder();
Logger.getLogger("").addHandler(handler);
try {
doGetHelper(req, resp);
doGetHelper(resp);
} finally {
Logger.getLogger("").removeHandler(handler);
}
Expand All @@ -89,7 +89,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
.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: ");
Expand Down
2 changes: 2 additions & 0 deletions netty/src/main/java/io/grpc/netty/JettyTlsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static synchronized boolean isJettyAlpnConfigured() {
static synchronized Throwable getJettyAlpnUnavailabilityCause() {
// This case should be unlikely
if (jettyAlpnUnavailabilityCause == null) {
@SuppressWarnings("UnusedVariable")
boolean discard = isJettyAlpnConfigured();
}
return jettyAlpnUnavailabilityCause;
Expand All @@ -93,6 +94,7 @@ static synchronized boolean isJettyNpnConfigured() {
static synchronized Throwable getJettyNpnUnavailabilityCause() {
// This case should be unlikely
if (jettyNpnUnavailabilityCause == null) {
@SuppressWarnings("UnusedVariable")
boolean discard = isJettyNpnConfigured();
}
return jettyNpnUnavailabilityCause;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ private boolean verifyHostName(String hostName, X509Certificate certificate) {
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);
Expand All @@ -129,6 +130,7 @@ public static List<String> allSubjectAltNames(X509Certificate certificate) {
return result;
}

@SuppressWarnings("MixedMutabilityReturnType")
private static List<String> getSubjectAltNames(X509Certificate certificate, int type) {
List<String> result = new ArrayList<>();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,8 @@ private void readData(Handler handler, int length, byte flags, int streamId)
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");
Expand All @@ -249,7 +250,8 @@ private void readPriority(Handler handler, int streamId) throws IOException {
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");
Expand Down Expand Up @@ -335,7 +337,8 @@ private void readPing(Handler handler, int length, byte flags, int streamId)
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");
Expand All @@ -353,7 +356,8 @@ private void readGoAway(Handler handler, int length, byte flags, int streamId)
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);
Expand Down
2 changes: 1 addition & 1 deletion protobuf-lite/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
4 changes: 0 additions & 4 deletions stub/src/test/java/io/grpc/stub/ServerCallsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,6 @@ private static class ServerCallRecorder extends ServerCall<Integer, Integer> {
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;
Expand All @@ -549,7 +547,6 @@ public void request(int numMessages) {

@Override
public void sendHeaders(Metadata headers) {
this.headers = headers;
}

@Override
Expand All @@ -560,7 +557,6 @@ public void sendMessage(Integer message) {
@Override
public void close(Status status, Metadata trailers) {
this.status = status;
this.trailers = trailers;
}

@Override
Expand Down

0 comments on commit 7657523

Please sign in to comment.