mirror of https://github.com/grpc/grpc-java.git
Upgrade error_prone_annotations to 2.3.4
This commit is contained in:
parent
bcda439317
commit
75f6fd8f10
|
|
@ -44,7 +44,7 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.4'
|
||||
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
|
||||
|
||||
implementation 'io.grpc:grpc-core:1.27.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
|
|
|
|||
12
build.gradle
12
build.gradle
|
|
@ -113,7 +113,7 @@ subprojects {
|
|||
libraries = [
|
||||
android_annotations: "com.google.android:annotations:4.1.1.4",
|
||||
animalsniffer_annotations: "org.codehaus.mojo:animal-sniffer-annotations:1.18",
|
||||
errorprone: "com.google.errorprone:error_prone_annotations:2.3.3",
|
||||
errorprone: "com.google.errorprone:error_prone_annotations:2.3.4",
|
||||
gson: "com.google.code.gson:gson:2.8.6",
|
||||
guava: "com.google.guava:guava:${guavaVersion}",
|
||||
hpack: 'com.twitter:hpack:0.10.1',
|
||||
|
|
@ -263,7 +263,7 @@ subprojects {
|
|||
|
||||
if (rootProject.properties.get('errorProne', true)) {
|
||||
dependencies {
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.4'
|
||||
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
|
||||
|
||||
annotationProcessor 'com.google.guava:guava-beta-checker:1.0'
|
||||
|
|
@ -279,9 +279,17 @@ subprojects {
|
|||
}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
// This project targets Java 7 (no method references)
|
||||
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
|
||||
// This project targets Java 7 (no time.Duration class)
|
||||
options.errorprone.check("PreferJavaTimeOverload", CheckSeverity.OFF)
|
||||
}
|
||||
compileTestJava {
|
||||
// LinkedList doesn't hurt much in tests and has lots of usages
|
||||
options.errorprone.check("JdkObsolete", CheckSeverity.OFF)
|
||||
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
|
||||
options.errorprone.check("PreferJavaTimeOverload", CheckSeverity.OFF)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@ dependencies {
|
|||
compile project(':grpc-api'),
|
||||
libraries.gson,
|
||||
libraries.android_annotations,
|
||||
libraries.perfmark
|
||||
libraries.errorprone // prefer our version to perfmark's 2.3.3
|
||||
compile (libraries.perfmark) {
|
||||
exclude group: 'com.google.errorprone', module: 'error_prone_annotations'
|
||||
}
|
||||
compile (libraries.opencensus_api) {
|
||||
// prefer our own versions instead of opencensus-api's dependency
|
||||
exclude group: 'com.google.code.findbugs', module: 'jsr305'
|
||||
|
|
@ -56,3 +59,12 @@ animalsniffer {
|
|||
sourceSets.test
|
||||
]
|
||||
}
|
||||
|
||||
import net.ltgt.gradle.errorprone.CheckSeverity
|
||||
|
||||
plugins.withId("java") {
|
||||
compileJmhJava {
|
||||
// This project targets Java 7 (no method references)
|
||||
options.errorprone.check("UnnecessaryAnonymousClass", CheckSeverity.OFF)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3417,7 +3417,7 @@ public class ManagedChannelImplTest {
|
|||
public void shutdown() {}
|
||||
}
|
||||
|
||||
final class FakeNameResolverFactory extends NameResolver.Factory {
|
||||
final class FakeNameResolverFactory2 extends NameResolver.Factory {
|
||||
FakeNameResolver resolver;
|
||||
|
||||
@Nullable
|
||||
|
|
@ -3432,7 +3432,7 @@ public class ManagedChannelImplTest {
|
|||
}
|
||||
}
|
||||
|
||||
FakeNameResolverFactory factory = new FakeNameResolverFactory();
|
||||
FakeNameResolverFactory2 factory = new FakeNameResolverFactory2();
|
||||
final class CustomBuilder extends AbstractManagedChannelImplBuilder<CustomBuilder> {
|
||||
|
||||
CustomBuilder() {
|
||||
|
|
|
|||
|
|
@ -3437,7 +3437,7 @@ public class ManagedChannelImplTest2 {
|
|||
public void shutdown() {}
|
||||
}
|
||||
|
||||
final class FakeNameResolverFactory extends NameResolver.Factory {
|
||||
final class FakeNameResolverFactory2 extends NameResolver.Factory {
|
||||
FakeNameResolver resolver;
|
||||
|
||||
@Nullable
|
||||
|
|
@ -3452,7 +3452,7 @@ public class ManagedChannelImplTest2 {
|
|||
}
|
||||
}
|
||||
|
||||
FakeNameResolverFactory factory = new FakeNameResolverFactory();
|
||||
FakeNameResolverFactory2 factory = new FakeNameResolverFactory2();
|
||||
final class CustomBuilder extends AbstractManagedChannelImplBuilder<CustomBuilder> {
|
||||
|
||||
CustomBuilder() {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.3'
|
||||
errorprone 'com.google.errorprone:error_prone_core:2.3.4'
|
||||
errorproneJavac 'com.google.errorprone:javac:9+181-r4173-1'
|
||||
|
||||
implementation 'io.grpc:grpc-core:1.27.0-SNAPSHOT' // CURRENT_GRPC_VERSION
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ public final class CronetClientStreamTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void run() {
|
||||
assertTrue(stream != null);
|
||||
stream.transportState().start(factory);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
<dependency>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_annotations</artifactId>
|
||||
<version>2.3.3</version> <!-- prefer to use 2.3.3 or later -->
|
||||
<version>2.3.4</version> <!-- prefer to use 2.3.3 or later -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class Util {
|
|||
= Metadata.Key.of("x-grpc-test-echo-trailing-bin", Metadata.BINARY_BYTE_MARSHALLER);
|
||||
|
||||
/** Assert that two messages are equal, producing a useful message if not. */
|
||||
@SuppressWarnings("LiteProtoToString")
|
||||
public static void assertEquals(MessageLite expected, MessageLite actual) {
|
||||
if (expected == null || actual == null) {
|
||||
Assert.assertEquals(expected, actual);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ java_library(
|
|||
"//api",
|
||||
"//core:internal",
|
||||
"@com_google_code_findbugs_jsr305//jar",
|
||||
"@com_google_errorprone_error_prone_annotations//jar",
|
||||
"@com_google_guava_guava//jar",
|
||||
"@com_google_j2objc_j2objc_annotations//jar",
|
||||
"@com_squareup_okhttp_okhttp//jar",
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ public class OkHttpClientStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void cancel_started() {
|
||||
stream.start(new BaseClientStreamListener());
|
||||
stream.transportState().start(1234);
|
||||
|
|
@ -145,6 +146,7 @@ public class OkHttpClientStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void start_alreadyCancelled() {
|
||||
stream.start(new BaseClientStreamListener());
|
||||
stream.cancel(Status.CANCELLED);
|
||||
|
|
@ -155,6 +157,7 @@ public class OkHttpClientStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void start_userAgentRemoved() throws IOException {
|
||||
Metadata metaData = new Metadata();
|
||||
metaData.put(GrpcUtil.USER_AGENT_KEY, "misbehaving-application");
|
||||
|
|
@ -171,6 +174,7 @@ public class OkHttpClientStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void start_headerFieldOrder() throws IOException {
|
||||
Metadata metaData = new Metadata();
|
||||
metaData.put(GrpcUtil.USER_AGENT_KEY, "misbehaving-application");
|
||||
|
|
@ -194,6 +198,7 @@ public class OkHttpClientStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void start_headerPlaintext() throws IOException {
|
||||
Metadata metaData = new Metadata();
|
||||
metaData.put(GrpcUtil.USER_AGENT_KEY, "misbehaving-application");
|
||||
|
|
@ -218,6 +223,7 @@ public class OkHttpClientStreamTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("GuardedBy")
|
||||
public void getUnaryRequest() throws IOException {
|
||||
MethodDescriptor<?, ?> getMethod = MethodDescriptor.<Void, Void>newBuilder()
|
||||
.setType(MethodDescriptor.MethodType.UNARY)
|
||||
|
|
|
|||
|
|
@ -2127,7 +2127,7 @@ public class OkHttpClientTransportTest {
|
|||
// The wait is safe; nextFrame is called in a loop and can have spurious wakeups
|
||||
@SuppressWarnings("WaitNotInLoop")
|
||||
@Override
|
||||
public boolean nextFrame(Handler handler) throws IOException {
|
||||
public boolean nextFrame(FrameReader.Handler handler) throws IOException {
|
||||
Result result;
|
||||
try {
|
||||
result = nextResults.take();
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package io.grpc.okhttp.internal.framed;
|
||||
|
||||
import com.google.errorprone.annotations.FormatMethod;
|
||||
import io.grpc.okhttp.internal.Protocol;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
|
@ -361,7 +362,7 @@ public final class Http2 implements Variant {
|
|||
throws IOException {
|
||||
if (length != 4) throw ioException("TYPE_WINDOW_UPDATE length !=4: %s", length);
|
||||
long increment = (source.readInt() & 0x7fffffffL);
|
||||
if (increment == 0) throw ioException("windowSizeIncrement was 0", increment);
|
||||
if (increment == 0) throw ioException("windowSizeIncrement was 0");
|
||||
handler.windowUpdate(streamId, increment);
|
||||
}
|
||||
|
||||
|
|
@ -586,10 +587,12 @@ public final class Http2 implements Variant {
|
|||
}
|
||||
}
|
||||
|
||||
@FormatMethod
|
||||
private static IllegalArgumentException illegalArgument(String message, Object... args) {
|
||||
throw new IllegalArgumentException(format(message, args));
|
||||
}
|
||||
|
||||
@FormatMethod
|
||||
private static IOException ioException(String message, Object... args) throws IOException {
|
||||
throw new IOException(format(message, args));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
|
|||
"com.google.auth:google-auth-library-oauth2-http:0.19.0",
|
||||
"com.google.code.findbugs:jsr305:3.0.2",
|
||||
"com.google.code.gson:gson:jar:2.8.6",
|
||||
"com.google.errorprone:error_prone_annotations:2.3.3",
|
||||
"com.google.errorprone:error_prone_annotations:2.3.4",
|
||||
"com.google.guava:failureaccess:1.0.1",
|
||||
"com.google.guava:guava:28.1-android",
|
||||
"com.google.j2objc:j2objc-annotations:1.3",
|
||||
|
|
@ -226,9 +226,9 @@ def com_google_code_gson_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.3",
|
||||
artifact = "com.google.errorprone:error_prone_annotations:2.3.4",
|
||||
server_urls = ["https://repo.maven.apache.org/maven2/"],
|
||||
artifact_sha256 = "ec59f1b702d9afc09e8c3929f5c42777dec623a6ea2731ac694332c7d7680f5a",
|
||||
artifact_sha256 = "baf7d6ea97ce606c53e11b6854ba5f2ce7ef5c24dddf0afa18d1260bd25b002c",
|
||||
licenses = ["notice"], # Apache 2.0
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ import io.grpc.Metadata;
|
|||
import io.grpc.MethodDescriptor;
|
||||
import io.grpc.MethodDescriptor.Marshaller;
|
||||
import io.grpc.ServerCall;
|
||||
import io.grpc.ServerCall.Listener;
|
||||
import io.grpc.ServerCallHandler;
|
||||
import io.grpc.ServerInterceptor;
|
||||
import io.grpc.Status;
|
||||
|
|
@ -408,7 +407,7 @@ final class BinlogHelper {
|
|||
|
||||
return new SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) {
|
||||
@Override
|
||||
public void start(final Listener<RespT> responseListener, Metadata headers) {
|
||||
public void start(final ClientCall.Listener<RespT> responseListener, Metadata headers) {
|
||||
final Duration timeout = deadline == null ? null
|
||||
: Durations.fromNanos(deadline.timeRemaining(TimeUnit.NANOSECONDS));
|
||||
writer.logClientHeader(
|
||||
|
|
@ -500,7 +499,7 @@ final class BinlogHelper {
|
|||
public ServerInterceptor getServerInterceptor(final long callId) {
|
||||
return new ServerInterceptor() {
|
||||
@Override
|
||||
public <ReqT, RespT> Listener<ReqT> interceptCall(
|
||||
public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
|
||||
final ServerCall<ReqT, RespT> call,
|
||||
Metadata headers,
|
||||
ServerCallHandler<ReqT, RespT> next) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ import io.grpc.MethodDescriptor;
|
|||
import io.grpc.MethodDescriptor.Marshaller;
|
||||
import io.grpc.MethodDescriptor.MethodType;
|
||||
import io.grpc.ServerCall;
|
||||
import io.grpc.ServerCall.Listener;
|
||||
import io.grpc.ServerCallHandler;
|
||||
import io.grpc.ServerInterceptor;
|
||||
import io.grpc.ServerMethodDefinition;
|
||||
|
|
@ -127,7 +126,7 @@ public class BinaryLogProviderTest {
|
|||
MethodDescriptor<RequestT, ResponseT> methodDescriptor, CallOptions callOptions) {
|
||||
return new NoopClientCall<RequestT, ResponseT>() {
|
||||
@Override
|
||||
public void start(Listener<ResponseT> responseListener, Metadata headers) {
|
||||
public void start(ClientCall.Listener<ResponseT> responseListener, Metadata headers) {
|
||||
listener.set(responseListener);
|
||||
}
|
||||
|
||||
|
|
@ -211,7 +210,7 @@ public class BinaryLogProviderTest {
|
|||
method,
|
||||
new ServerCallHandler<String, Integer>() {
|
||||
@Override
|
||||
public Listener<String> startCall(
|
||||
public ServerCall.Listener<String> startCall(
|
||||
ServerCall<String, Integer> call, Metadata headers) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
|
@ -310,7 +309,7 @@ public class BinaryLogProviderTest {
|
|||
assertSame(BinaryLogProvider.BYTEARRAY_MARSHALLER, method.getResponseMarshaller());
|
||||
return new SimpleForwardingClientCall<ReqT, RespT>(next.newCall(method, callOptions)) {
|
||||
@Override
|
||||
public void start(Listener<RespT> responseListener, Metadata headers) {
|
||||
public void start(ClientCall.Listener<RespT> responseListener, Metadata headers) {
|
||||
super.start(
|
||||
new SimpleForwardingClientCallListener<RespT>(responseListener) {
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in New Issue