Skip to content

Commit 7657523

Browse files
all: update to error prone 2.3.3
1 parent 16de96b commit 7657523

File tree

19 files changed

+44
-37
lines changed

19 files changed

+44
-37
lines changed

alts/src/main/java/io/grpc/alts/internal/AltsHandshakerClient.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public byte[] getKey() {
136136
throw new IllegalStateException("Could not get enough key data from the handshake.");
137137
}
138138
byte[] key = new byte[KEY_LENGTH];
139-
result.getKeyData().copyTo(key, 0, 0, KEY_LENGTH);
139+
result.getKeyData().copyTo(key, 0);
140140
return key;
141141
}
142142

alts/src/test/java/io/grpc/alts/internal/AltsProtocolNegotiatorTest.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import io.grpc.Channel;
2828
import io.grpc.Grpc;
2929
import io.grpc.InternalChannelz;
30-
import io.grpc.InternalChannelz.Security;
3130
import io.grpc.ManagedChannel;
3231
import io.grpc.SecurityLevel;
3332
import io.grpc.alts.internal.AltsProtocolNegotiator.LazyChannel;
@@ -396,7 +395,6 @@ private CapturingGrpcHttp2ConnectionHandler capturingGrpcHandler() {
396395
private final class CapturingGrpcHttp2ConnectionHandler extends GrpcHttp2ConnectionHandler {
397396

398397
private Attributes attrs;
399-
private Security securityInfo;
400398

401399
private CapturingGrpcHttp2ConnectionHandler(
402400
Http2ConnectionDecoder decoder,
@@ -407,11 +405,11 @@ private CapturingGrpcHttp2ConnectionHandler(
407405

408406
@Override
409407
public void handleProtocolNegotiationCompleted(
410-
Attributes attrs, InternalChannelz.Security securityInfo) {
408+
Attributes attrs,
409+
@SuppressWarnings("UnusedVariable") InternalChannelz.Security securityInfo) {
411410
// If we are added to the pipeline, we need to remove ourselves. The HTTP2 handler
412411
channel.pipeline().remove(this);
413412
this.attrs = attrs;
414-
this.securityInfo = securityInfo;
415413
}
416414
}
417415

android/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ repositories {
4343
}
4444

4545
dependencies {
46-
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
46+
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
4747
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
4848

4949
implementation 'io.grpc:grpc-core:1.22.0-SNAPSHOT' // CURRENT_GRPC_VERSION

api/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies {
66
libraries.jsr305,
77
libraries.animalsniffer_annotations
88
compile (libraries.guava) {
9-
// prefer 2.3.2 from libraries instead of 2.1.3
9+
// prefer 2.3.3 from libraries instead of 2.1.3
1010
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
1111
// prefer 3.0.2 from libraries instead of 3.0.1
1212
exclude group: 'com.google.code.findbugs', module: 'jsr305'

api/src/test/java/io/grpc/ServiceProvidersTest.java

+11-13
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void unknownClassProvider() {
125125
ClassLoader cl = new ReplacingClassLoader(getClass().getClassLoader(), serviceFile,
126126
"io/grpc/ServiceProvidersTestAbstractProvider-unknownClassProvider.txt");
127127
try {
128-
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
128+
ServiceProviders.load(
129129
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
130130
fail("Exception expected");
131131
} catch (ServiceConfigurationError e) {
@@ -140,7 +140,7 @@ public void exceptionSurfacedToCaller_failAtInit() {
140140
try {
141141
// Even though there is a working provider, if any providers fail then we should fail
142142
// completely to avoid returning something unexpected.
143-
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
143+
ServiceProviders.load(
144144
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
145145
fail("Expected exception");
146146
} catch (ServiceConfigurationError expected) {
@@ -154,7 +154,7 @@ public void exceptionSurfacedToCaller_failAtPriority() {
154154
"io/grpc/ServiceProvidersTestAbstractProvider-failAtPriorityProvider.txt");
155155
try {
156156
// The exception should be surfaced to the caller
157-
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
157+
ServiceProviders.load(
158158
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
159159
fail("Expected exception");
160160
} catch (FailAtPriorityProvider.PriorityException expected) {
@@ -168,7 +168,7 @@ public void exceptionSurfacedToCaller_failAtAvailable() {
168168
"io/grpc/ServiceProvidersTestAbstractProvider-failAtAvailableProvider.txt");
169169
try {
170170
// The exception should be surfaced to the caller
171-
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.load(
171+
ServiceProviders.load(
172172
ServiceProvidersTestAbstractProvider.class, NO_HARDCODED, cl, ACCESSOR);
173173
fail("Expected exception");
174174
} catch (FailAtAvailableProvider.AvailableException expected) {
@@ -193,10 +193,9 @@ public void getCandidatesViaHardCoded_multipleProvider() throws Exception {
193193
@Test
194194
public void getCandidatesViaHardCoded_failAtInit() throws Exception {
195195
try {
196-
Iterable<ServiceProvidersTestAbstractProvider> ignored =
197-
ServiceProviders.getCandidatesViaHardCoded(
198-
ServiceProvidersTestAbstractProvider.class,
199-
Collections.<Class<?>>singletonList(FailAtInitProvider.class));
196+
ServiceProviders.getCandidatesViaHardCoded(
197+
ServiceProvidersTestAbstractProvider.class,
198+
Collections.<Class<?>>singletonList(FailAtInitProvider.class));
200199
fail("Expected exception");
201200
} catch (ServiceConfigurationError expected) {
202201
// noop
@@ -206,10 +205,9 @@ public void getCandidatesViaHardCoded_failAtInit() throws Exception {
206205
@Test
207206
public void getCandidatesViaHardCoded_failAtInit_moreCandidates() throws Exception {
208207
try {
209-
Iterable<ServiceProvidersTestAbstractProvider> ignored =
210-
ServiceProviders.getCandidatesViaHardCoded(
211-
ServiceProvidersTestAbstractProvider.class,
212-
ImmutableList.<Class<?>>of(FailAtInitProvider.class, Available0Provider.class));
208+
ServiceProviders.getCandidatesViaHardCoded(
209+
ServiceProvidersTestAbstractProvider.class,
210+
ImmutableList.<Class<?>>of(FailAtInitProvider.class, Available0Provider.class));
213211
fail("Expected exception");
214212
} catch (ServiceConfigurationError expected) {
215213
// noop
@@ -221,7 +219,7 @@ public void create_throwsErrorOnMisconfiguration() throws Exception {
221219
class PrivateClass {}
222220

223221
try {
224-
ServiceProvidersTestAbstractProvider ignored = ServiceProviders.create(
222+
ServiceProviders.create(
225223
ServiceProvidersTestAbstractProvider.class, PrivateClass.class);
226224
fail("Expected exception");
227225
} catch (ServiceConfigurationError expected) {

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ subprojects {
3131
apply plugin: "net.ltgt.errorprone"
3232
if (rootProject.properties.get('errorProne', true)) {
3333
dependencies {
34-
errorprone 'com.google.errorprone:error_prone_core:2.3.2'
34+
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
3535
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
3636

3737
annotationProcessor 'com.google.guava:guava-beta-checker:1.0'

context/src/test/java/io/grpc/ContextTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ public void close() throws SecurityException {
967967
assertNull(logRef.get());
968968
ctx = ctx.fork();
969969
}
970-
ctx = ctx.fork();
970+
ctx.fork();
971971
assertNotNull(logRef.get());
972972
assertNotNull(logRef.get().getThrown());
973973
assertEquals(Level.SEVERE, logRef.get().getLevel());

core/src/main/java/io/grpc/internal/InternalSubchannel.java

-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
import java.util.List;
5656
import java.util.concurrent.ScheduledExecutorService;
5757
import java.util.concurrent.TimeUnit;
58-
import java.util.logging.Logger;
5958
import javax.annotation.Nullable;
6059
import javax.annotation.concurrent.ThreadSafe;
6160

@@ -64,7 +63,6 @@
6463
*/
6564
@ThreadSafe
6665
final class InternalSubchannel implements InternalInstrumented<ChannelStats>, TransportProvider {
67-
private static final Logger log = Logger.getLogger(InternalSubchannel.class.getName());
6866

6967
private final InternalLogId logId;
7068
private final String authority;

core/src/main/java/io/grpc/internal/ManagedChannelImpl.java

+1
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ public void uncaughtException(Thread t, Throwable e) {
254254
// Must be mutated and read from constructor or syncContext
255255
// See service config error handling spec for reference.
256256
// TODO(notcarl): check this value when error in service config resolution
257+
@SuppressWarnings("UnusedVariable")
257258
private boolean waitingForServiceConfig = true;
258259
private final boolean lookUpServiceConfig;
259260

core/src/main/java/io/grpc/internal/ManagedChannelServiceConfig.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ final class ManagedChannelServiceConfig {
4545
private final Map<String, MethodInfo> serviceMap;
4646
// TODO(notcarl/zdapeng): use retryThrottling here
4747
@Nullable
48+
@SuppressWarnings("unused")
4849
private final Throttle retryThrottling;
4950
@Nullable
5051
private final Object loadBalancingConfig;

core/src/test/java/io/grpc/internal/ManagedChannelOrphanWrapperTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public void orphanedChannelsAreLogged() {
5454
new ConcurrentHashMap<>();
5555

5656
assertEquals(0, refs.size());
57+
@SuppressWarnings("UnusedVariable")
5758
ManagedChannelOrphanWrapper channel = new ManagedChannelOrphanWrapper(mc, refqueue, refs);
5859
assertEquals(1, refs.size());
5960

@@ -106,8 +107,11 @@ public void refCycleIsGCed() {
106107
new ReferenceQueue<>();
107108
ConcurrentMap<ManagedChannelReference, ManagedChannelReference> refs =
108109
new ConcurrentHashMap<>();
110+
@SuppressWarnings("UnusedVariable")
109111
ApplicationWithChannelRef app = new ApplicationWithChannelRef();
112+
@SuppressWarnings("UnusedVariable")
110113
ChannelWithApplicationRef channelImpl = new ChannelWithApplicationRef();
114+
@SuppressWarnings("UnusedVariable")
111115
ManagedChannelOrphanWrapper channel =
112116
new ManagedChannelOrphanWrapper(channelImpl, refqueue, refs);
113117
app.channel = channel;
@@ -164,10 +168,12 @@ public String authority() {
164168
}
165169

166170
private static final class ApplicationWithChannelRef {
171+
@SuppressWarnings("UnusedVariable")
167172
private ManagedChannel channel;
168173
}
169174

170175
private static final class ChannelWithApplicationRef extends TestManagedChannel {
176+
@SuppressWarnings("UnusedVariable")
171177
private ApplicationWithChannelRef application;
172178
}
173179
}

gae-interop-testing/gae-jdk8/src/main/java/io/grpc/testing/integration/NettyClientInteropServlet.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
8080
LogEntryRecorder handler = new LogEntryRecorder();
8181
Logger.getLogger("").addHandler(handler);
8282
try {
83-
doGetHelper(req, resp);
83+
doGetHelper(resp);
8484
} finally {
8585
Logger.getLogger("").removeHandler(handler);
8686
}
@@ -89,7 +89,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
8989
.append(handler.getLogOutput());
9090
}
9191

92-
private void doGetHelper(HttpServletRequest req, HttpServletResponse resp) throws IOException {
92+
private void doGetHelper(HttpServletResponse resp) throws IOException {
9393
resp.setContentType("text/plain");
9494
PrintWriter writer = resp.getWriter();
9595
writer.println("Test invoked at: ");

netty/src/main/java/io/grpc/netty/JettyTlsUtil.java

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ static synchronized boolean isJettyAlpnConfigured() {
7272
static synchronized Throwable getJettyAlpnUnavailabilityCause() {
7373
// This case should be unlikely
7474
if (jettyAlpnUnavailabilityCause == null) {
75+
@SuppressWarnings("UnusedVariable")
7576
boolean discard = isJettyAlpnConfigured();
7677
}
7778
return jettyAlpnUnavailabilityCause;
@@ -93,6 +94,7 @@ static synchronized boolean isJettyNpnConfigured() {
9394
static synchronized Throwable getJettyNpnUnavailabilityCause() {
9495
// This case should be unlikely
9596
if (jettyNpnUnavailabilityCause == null) {
97+
@SuppressWarnings("UnusedVariable")
9698
boolean discard = isJettyNpnConfigured();
9799
}
98100
return jettyNpnUnavailabilityCause;

okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/CipherSuite.java

+1
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ public enum CipherSuite {
366366
* @param sinceJavaVersion the first major Java release supporting this cipher suite.
367367
* @param sinceAndroidVersion the first Android SDK version supporting this cipher suite.
368368
*/
369+
@SuppressWarnings("UnusedVariable")
369370
private CipherSuite(
370371
String javaName, int value, int rfc, int sinceJavaVersion, int sinceAndroidVersion) {
371372
this.javaName = javaName;

okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/OkHostnameVerifier.java

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ private boolean verifyHostName(String hostName, X509Certificate certificate) {
120120
return false;
121121
}
122122

123+
@SuppressWarnings("MixedMutabilityReturnType")
123124
public static List<String> allSubjectAltNames(X509Certificate certificate) {
124125
List<String> altIpaNames = getSubjectAltNames(certificate, ALT_IPA_NAME);
125126
List<String> altDnsNames = getSubjectAltNames(certificate, ALT_DNS_NAME);
@@ -129,6 +130,7 @@ public static List<String> allSubjectAltNames(X509Certificate certificate) {
129130
return result;
130131
}
131132

133+
@SuppressWarnings("MixedMutabilityReturnType")
132134
private static List<String> getSubjectAltNames(X509Certificate certificate, int type) {
133135
List<String> result = new ArrayList<>();
134136
try {

okhttp/third_party/okhttp/main/java/io/grpc/okhttp/internal/framed/Http2.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ private void readData(Handler handler, int length, byte flags, int streamId)
234234
source.skip(padding);
235235
}
236236

237-
private void readPriority(Handler handler, int length, byte flags, int streamId)
237+
private void readPriority(
238+
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
238239
throws IOException {
239240
if (length != 5) throw ioException("TYPE_PRIORITY length: %d != 5", length);
240241
if (streamId == 0) throw ioException("TYPE_PRIORITY streamId == 0");
@@ -249,7 +250,8 @@ private void readPriority(Handler handler, int streamId) throws IOException {
249250
handler.priority(streamId, streamDependency, weight, exclusive);
250251
}
251252

252-
private void readRstStream(Handler handler, int length, byte flags, int streamId)
253+
private void readRstStream(
254+
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
253255
throws IOException {
254256
if (length != 4) throw ioException("TYPE_RST_STREAM length: %d != 4", length);
255257
if (streamId == 0) throw ioException("TYPE_RST_STREAM streamId == 0");
@@ -335,7 +337,8 @@ private void readPing(Handler handler, int length, byte flags, int streamId)
335337
handler.ping(ack, payload1, payload2);
336338
}
337339

338-
private void readGoAway(Handler handler, int length, byte flags, int streamId)
340+
private void readGoAway(
341+
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
339342
throws IOException {
340343
if (length < 8) throw ioException("TYPE_GOAWAY length < 8: %s", length);
341344
if (streamId != 0) throw ioException("TYPE_GOAWAY streamId != 0");
@@ -353,7 +356,8 @@ private void readGoAway(Handler handler, int length, byte flags, int streamId)
353356
handler.goAway(lastStreamId, errorCode, debugData);
354357
}
355358

356-
private void readWindowUpdate(Handler handler, int length, byte flags, int streamId)
359+
private void readWindowUpdate(
360+
Handler handler, int length, @SuppressWarnings("UnusedVariable") byte flags, int streamId)
357361
throws IOException {
358362
if (length != 4) throw ioException("TYPE_WINDOW_UPDATE length !=4: %s", length);
359363
long increment = (source.readInt() & 0x7fffffffL);

protobuf-lite/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ dependencies {
1515
compile project(':grpc-api'),
1616
libraries.protobuf_lite
1717
compile (libraries.guava) {
18-
// prefer 2.3.2 from libraries instead of 2.1.3
18+
// prefer 2.3.3 from libraries instead of 2.1.3
1919
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
2020
// prefer 3.0.2 from libraries instead of 3.0.1
2121
exclude group: 'com.google.code.findbugs', module: 'jsr305'

repositories.bzl

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ def com_google_code_gson():
196196
def com_google_errorprone_error_prone_annotations():
197197
jvm_maven_import_external(
198198
name = "com_google_errorprone_error_prone_annotations",
199-
artifact = "com.google.errorprone:error_prone_annotations:2.3.2",
199+
artifact = "com.google.errorprone:error_prone_annotations:2.3.3",
200200
server_urls = ["http://central.maven.org/maven2"],
201-
artifact_sha256 = "357cd6cfb067c969226c442451502aee13800a24e950fdfde77bcdb4565a668d",
201+
artifact_sha256 = "ec59f1b702d9afc09e8c3929f5c42777dec623a6ea2731ac694332c7d7680f5a",
202202
licenses = ["notice"], # Apache 2.0
203203
)
204204

stub/src/test/java/io/grpc/stub/ServerCallsTest.java

-4
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,6 @@ private static class ServerCallRecorder extends ServerCall<Integer, Integer> {
532532
private final MethodDescriptor<Integer, Integer> methodDescriptor;
533533
private final List<Integer> requestCalls = new ArrayList<>();
534534
private final List<Integer> responses = new ArrayList<>();
535-
private Metadata headers;
536-
private Metadata trailers;
537535
private Status status;
538536
private boolean isCancelled;
539537
private boolean isReady;
@@ -549,7 +547,6 @@ public void request(int numMessages) {
549547

550548
@Override
551549
public void sendHeaders(Metadata headers) {
552-
this.headers = headers;
553550
}
554551

555552
@Override
@@ -560,7 +557,6 @@ public void sendMessage(Integer message) {
560557
@Override
561558
public void close(Status status, Metadata trailers) {
562559
this.status = status;
563-
this.trailers = trailers;
564560
}
565561

566562
@Override

0 commit comments

Comments
 (0)