diff --git a/README.md b/README.md index fecc056436..48a2e087d8 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use protobuf-maven-plugin 0.6.1 - com.google.protobuf:protoc:3.22.3:exe:${os.detected.classifier} + com.google.protobuf:protoc:3.23.4:exe:${os.detected.classifier} grpc-java io.grpc:protoc-gen-grpc-java:1.56.0:exe:${os.detected.classifier} @@ -157,7 +157,7 @@ plugins { protobuf { protoc { - artifact = "com.google.protobuf:protoc:3.22.3" + artifact = "com.google.protobuf:protoc:3.23.4" } plugins { grpc { @@ -190,7 +190,7 @@ plugins { protobuf { protoc { - artifact = "com.google.protobuf:protoc:3.22.3" + artifact = "com.google.protobuf:protoc:3.23.4" } plugins { grpc { diff --git a/api/src/context/java/io/grpc/Context.java b/api/src/context/java/io/grpc/Context.java index f63f021216..4c2c61065c 100644 --- a/api/src/context/java/io/grpc/Context.java +++ b/api/src/context/java/io/grpc/Context.java @@ -808,7 +808,7 @@ public class Context { *

Calling {@code cancel(null)} is the same as calling {@link #close}. * * @return {@code true} if this context cancelled the context and notified listeners, - * {@code false} if the context was already cancelled. + * {@code false} if the context was already cancelled. */ @CanIgnoreReturnValue public boolean cancel(Throwable cause) { diff --git a/api/src/main/java/io/grpc/ManagedChannelBuilder.java b/api/src/main/java/io/grpc/ManagedChannelBuilder.java index 15d2fbdd31..9012d05409 100644 --- a/api/src/main/java/io/grpc/ManagedChannelBuilder.java +++ b/api/src/main/java/io/grpc/ManagedChannelBuilder.java @@ -571,10 +571,10 @@ public abstract class ManagedChannelBuilder> * return o; * }} * + * @return this * @throws IllegalArgumentException When the given serviceConfig is invalid or the current version * of grpc library can not parse it gracefully. The state of the builder is unchanged if * an exception is thrown. - * @return this * @since 1.20.0 */ @ExperimentalApi("https://github.com/grpc/grpc-java/issues/5189") diff --git a/api/src/main/java/io/grpc/ServerInterceptors.java b/api/src/main/java/io/grpc/ServerInterceptors.java index b44a7b6c88..0bc6d07c83 100644 --- a/api/src/main/java/io/grpc/ServerInterceptors.java +++ b/api/src/main/java/io/grpc/ServerInterceptors.java @@ -291,23 +291,23 @@ public final class ServerInterceptors { final Metadata headers) { final ServerCall unwrappedCall = new PartialForwardingServerCall() { - @Override - protected ServerCall delegate() { - return call; - } + @Override + protected ServerCall delegate() { + return call; + } - @Override - public void sendMessage(ORespT message) { - final InputStream is = originalMethod.streamResponse(message); - final WRespT wrappedMessage = wrappedMethod.parseResponse(is); - delegate().sendMessage(wrappedMessage); - } + @Override + public void sendMessage(ORespT message) { + final InputStream is = originalMethod.streamResponse(message); + final WRespT wrappedMessage = wrappedMethod.parseResponse(is); + delegate().sendMessage(wrappedMessage); + } - @Override - public MethodDescriptor getMethodDescriptor() { - return originalMethod; - } - }; + @Override + public MethodDescriptor getMethodDescriptor() { + return originalMethod; + } + }; final ServerCall.Listener originalListener = originalHandler .startCall(unwrappedCall, headers); diff --git a/api/src/test/java/io/grpc/ForwardingServerCallTest.java b/api/src/test/java/io/grpc/ForwardingServerCallTest.java index e6cb63fdd2..8030b65ecc 100644 --- a/api/src/test/java/io/grpc/ForwardingServerCallTest.java +++ b/api/src/test/java/io/grpc/ForwardingServerCallTest.java @@ -48,7 +48,7 @@ public class ForwardingServerCallTest { protected ServerCall delegate() { return serverCall; } - }; + }; } @Test diff --git a/api/src/test/java/io/grpc/MetadataTest.java b/api/src/test/java/io/grpc/MetadataTest.java index 51aecc638e..073a505c82 100644 --- a/api/src/test/java/io/grpc/MetadataTest.java +++ b/api/src/test/java/io/grpc/MetadataTest.java @@ -54,16 +54,16 @@ public class MetadataTest { private static final Metadata.BinaryMarshaller FISH_MARSHALLER = new Metadata.BinaryMarshaller() { - @Override - public byte[] toBytes(Fish fish) { - return fish.name.getBytes(UTF_8); - } + @Override + public byte[] toBytes(Fish fish) { + return fish.name.getBytes(UTF_8); + } - @Override - public Fish parseBytes(byte[] serialized) { - return new Fish(new String(serialized, UTF_8)); - } - }; + @Override + public Fish parseBytes(byte[] serialized) { + return new Fish(new String(serialized, UTF_8)); + } + }; private static class FishStreamMarsaller implements Metadata.BinaryStreamMarshaller { @Override @@ -100,16 +100,16 @@ public class MetadataTest { private static final Metadata.BinaryStreamMarshaller IMMUTABLE_FISH_MARSHALLER = new Metadata.BinaryStreamMarshaller() { - @Override - public InputStream toStream(Fish fish) { - return new FakeFishStream(fish); - } + @Override + public InputStream toStream(Fish fish) { + return new FakeFishStream(fish); + } - @Override - public Fish parseStream(InputStream stream) { - return ((FakeFishStream) stream).fish; - } - }; + @Override + public Fish parseStream(InputStream stream) { + return ((FakeFishStream) stream).fish; + } + }; private static final String LANCE = "lance"; private static final byte[] LANCE_BYTES = LANCE.getBytes(US_ASCII); @@ -313,6 +313,7 @@ public class MetadataTest { } @Test + @SuppressWarnings("StringCaseLocaleUsage") // System locale is exactly what we're testing. public void testKeyCaseHandling() { Locale originalLocale = Locale.getDefault(); Locale.setDefault(new Locale("tr", "TR")); diff --git a/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java b/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java index 2c3bf7e9c8..ab20c11125 100644 --- a/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java +++ b/api/src/test/java/io/grpc/StatusRuntimeExceptionTest.java @@ -54,15 +54,13 @@ public class StatusRuntimeExceptionTest { @Test public void extendAndOverridePreservesStack() { final StackTraceElement element = new StackTraceElement("a", "b", "c", 4); - StatusRuntimeException exception = - new StatusRuntimeException(Status.CANCELLED, new Metadata()) { - + StatusRuntimeException error = new StatusRuntimeException(Status.CANCELLED, new Metadata()) { @Override public synchronized Throwable fillInStackTrace() { setStackTrace(new StackTraceElement[]{element}); return this; } }; - assertThat(exception.getStackTrace()).asList().containsExactly(element); + assertThat(error.getStackTrace()).asList().containsExactly(element); } } diff --git a/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/AbstractBenchmark.java b/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/AbstractBenchmark.java index 3edc92ac02..d68e66561a 100644 --- a/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/AbstractBenchmark.java +++ b/benchmarks/src/jmh/java/io/grpc/benchmarks/netty/AbstractBenchmark.java @@ -78,6 +78,7 @@ public abstract class AbstractBenchmark { SMALL(10), MEDIUM(1024), LARGE(65536), JUMBO(1048576); private final int bytes; + MessageSize(int bytes) { this.bytes = bytes; } @@ -94,6 +95,7 @@ public abstract class AbstractBenchmark { SMALL(16383), MEDIUM(65535), LARGE(1048575), JUMBO(8388607); private final int bytes; + FlowWindowSize(int bytes) { this.bytes = bytes; } diff --git a/build.gradle b/build.gradle index 094a36eee6..deaa6d82ef 100644 --- a/build.gradle +++ b/build.gradle @@ -162,7 +162,8 @@ subprojects { checkstyle { configDirectory = file("$rootDir/buildscripts") - toolVersion = libs.checkstyle.get().version + toolVersion = JavaVersion.current().isJava11Compatible() ? libs.checkstyle.get().version : libs.checkstylejava8.get().version + ignoreFailures = false if (rootProject.hasProperty("checkstyle.ignoreFailures")) { ignoreFailures = rootProject.properties["checkstyle.ignoreFailures"].toBoolean() @@ -245,6 +246,11 @@ subprojects { options.errorprone.check("JavaUtilDate", CheckSeverity.OFF) // The warning fails to provide a source location options.errorprone.check("MissingSummary", CheckSeverity.OFF) + + // TODO(https://github.com/grpc/grpc-java/issues/10372): remove when fixed. + if (JavaVersion.current().isJava11Compatible()) { + options.errorprone.check("StringCaseLocaleUsage", CheckSeverity.OFF) + } } tasks.named("compileTestJava").configure { // LinkedList doesn't hurt much in tests and has lots of usages @@ -573,7 +579,7 @@ tasks.register('checkForUpdates') { if (oldResolved != newResolved) { def oldId = oldResolved.id.componentIdentifier def newId = newResolved.id.componentIdentifier - println("${newId.group}:${newId.module} ${oldId.version} -> ${newId.version}") + println("libs.${name} = ${newId.group}:${newId.module} ${oldId.version} -> ${newId.version}") } } } diff --git a/buildscripts/checkstyle.xml b/buildscripts/checkstyle.xml index a5aded93a8..960fa162ed 100644 --- a/buildscripts/checkstyle.xml +++ b/buildscripts/checkstyle.xml @@ -199,7 +199,7 @@ - + - 3.22.3 + 3.23.4 1.8 1.8 diff --git a/examples/example-gauth/build.gradle b/examples/example-gauth/build.gradle index f60328aebb..77cfbbe3f3 100644 --- a/examples/example-gauth/build.gradle +++ b/examples/example-gauth/build.gradle @@ -24,7 +24,7 @@ targetCompatibility = 1.8 // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protobufVersion = '3.22.3' +def protobufVersion = '3.23.4' def protocVersion = protobufVersion diff --git a/examples/example-gauth/pom.xml b/examples/example-gauth/pom.xml index 09e4c276d6..3edbf03017 100644 --- a/examples/example-gauth/pom.xml +++ b/examples/example-gauth/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.58.0-SNAPSHOT - 3.22.3 + 3.23.4 1.8 1.8 diff --git a/examples/example-gcp-observability/build.gradle b/examples/example-gcp-observability/build.gradle index 704c14a8f4..854b1a1d28 100644 --- a/examples/example-gcp-observability/build.gradle +++ b/examples/example-gcp-observability/build.gradle @@ -25,7 +25,7 @@ targetCompatibility = 1.8 // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protocVersion = '3.22.3' +def protocVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}" diff --git a/examples/example-hostname/build.gradle b/examples/example-hostname/build.gradle index c1e566afec..8ad976469f 100644 --- a/examples/example-hostname/build.gradle +++ b/examples/example-hostname/build.gradle @@ -22,7 +22,7 @@ targetCompatibility = 1.8 // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protobufVersion = '3.22.3' +def protobufVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}" diff --git a/examples/example-hostname/pom.xml b/examples/example-hostname/pom.xml index f27038d8c3..1cec531942 100644 --- a/examples/example-hostname/pom.xml +++ b/examples/example-hostname/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.58.0-SNAPSHOT - 3.22.3 + 3.23.4 1.8 1.8 diff --git a/examples/example-jwt-auth/build.gradle b/examples/example-jwt-auth/build.gradle index 5f7ed7dd6c..ad069055b0 100644 --- a/examples/example-jwt-auth/build.gradle +++ b/examples/example-jwt-auth/build.gradle @@ -23,7 +23,7 @@ targetCompatibility = 1.8 // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protobufVersion = '3.22.3' +def protobufVersion = '3.23.4' def protocVersion = protobufVersion dependencies { diff --git a/examples/example-jwt-auth/pom.xml b/examples/example-jwt-auth/pom.xml index 1b958c266a..0ed7b4cc03 100644 --- a/examples/example-jwt-auth/pom.xml +++ b/examples/example-jwt-auth/pom.xml @@ -14,8 +14,8 @@ UTF-8 1.58.0-SNAPSHOT - 3.22.3 - 3.22.3 + 3.23.4 + 3.23.4 1.8 1.8 diff --git a/examples/example-orca/build.gradle b/examples/example-orca/build.gradle index ebb1d9a1ac..c0cfbab2a8 100644 --- a/examples/example-orca/build.gradle +++ b/examples/example-orca/build.gradle @@ -18,7 +18,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protocVersion = '3.22.3' +def protocVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}" diff --git a/examples/example-reflection/build.gradle b/examples/example-reflection/build.gradle index cb04c2b248..473a611175 100644 --- a/examples/example-reflection/build.gradle +++ b/examples/example-reflection/build.gradle @@ -18,7 +18,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protocVersion = '3.22.3' +def protocVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}" diff --git a/examples/example-servlet/build.gradle b/examples/example-servlet/build.gradle index ba11a40029..2d8dbc82c9 100644 --- a/examples/example-servlet/build.gradle +++ b/examples/example-servlet/build.gradle @@ -16,7 +16,7 @@ sourceCompatibility = 1.8 targetCompatibility = 1.8 def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protocVersion = '3.22.3' +def protocVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}", diff --git a/examples/example-tls/build.gradle b/examples/example-tls/build.gradle index 2134285f40..5a90084898 100644 --- a/examples/example-tls/build.gradle +++ b/examples/example-tls/build.gradle @@ -24,7 +24,7 @@ targetCompatibility = 1.8 // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protocVersion = '3.22.3' +def protocVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}" diff --git a/examples/example-tls/pom.xml b/examples/example-tls/pom.xml index 0015d7289c..371d3bce03 100644 --- a/examples/example-tls/pom.xml +++ b/examples/example-tls/pom.xml @@ -13,7 +13,7 @@ UTF-8 1.58.0-SNAPSHOT - 3.22.3 + 3.23.4 1.8 1.8 diff --git a/examples/example-xds/build.gradle b/examples/example-xds/build.gradle index c6a3ab31f7..eb9316a378 100644 --- a/examples/example-xds/build.gradle +++ b/examples/example-xds/build.gradle @@ -23,7 +23,7 @@ targetCompatibility = 1.8 // Feel free to delete the comment at the next line. It is just for safely // updating the version in our release process. def grpcVersion = '1.58.0-SNAPSHOT' // CURRENT_GRPC_VERSION -def protocVersion = '3.22.3' +def protocVersion = '3.23.4' dependencies { implementation "io.grpc:grpc-protobuf:${grpcVersion}" diff --git a/examples/pom.xml b/examples/pom.xml index a8c14848d2..793604cd80 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -13,8 +13,8 @@ UTF-8 1.58.0-SNAPSHOT - 3.22.3 - 3.22.3 + 3.23.4 + 3.23.4 1.8 1.8 diff --git a/gcp-observability/build.gradle b/gcp-observability/build.gradle index 38fb3d0fcd..e7e78849d6 100644 --- a/gcp-observability/build.gradle +++ b/gcp-observability/build.gradle @@ -20,8 +20,6 @@ tasks.named("compileJava").configure { } dependencies { - def cloudLoggingVersion = '3.14.5' - annotationProcessor libraries.auto.value api project(':grpc-api') @@ -32,7 +30,7 @@ dependencies { project(':grpc-census'), libraries.opencensus.contrib.grpc.metrics // Avoid gradle using project dependencies without configuration: shadow - implementation ("com.google.cloud:google-cloud-logging:${cloudLoggingVersion}") { + implementation (libraries.google.cloud.logging) { exclude group: 'io.grpc', module: 'grpc-alts' exclude group: 'io.grpc', module: 'grpc-netty-shaded' exclude group: 'io.grpc', module: 'grpc-xds' @@ -57,10 +55,10 @@ dependencies { project(':grpc-grpclb'), // Align grpc versions project(':grpc-services'), // Align grpc versions libraries.animalsniffer.annotations, // Use our newer version + libraries.auto.value.annotations, // Use our newer version libraries.guava.jre, // Use our newer version libraries.protobuf.java.util, // Use our newer version libraries.re2j, // Use our newer version - libraries.checker.qual, // Explicit dependency to keep in step with version used by guava libraries.j2objc.annotations // Explicit dependency to keep in step with version used by guava testImplementation testFixtures(project(':grpc-api')), diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b7dcd99855..40f174a809 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,18 +2,28 @@ # Compatibility problem with internal version getting onto 1.5.3. # https://github.com/grpc/grpc-java/pull/9118 googleauth = "1.4.0" -guava = "32.0.1-android" +# Update notes / 2023-07-19 sergiitk: +# Couldn't update to 32.1.1 because Guava 32.1.0 broke gradle metadata: +# https://github.com/google/guava/releases/tag/v32.1.0 +# 32.1.1 partially fixed this, but our build still breaks with: +# Could not resolve com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava. +# +# TODO(any release manager): attempt removing runtimeOnly dependencies when guava upgraded: +# - okhttp: errorprone.annotations +# +# Allowed to be different from guava-jre. +guava = '32.0.1-android' netty = '4.1.94.Final' # Keep the following references of tcnative version in sync whenever it's updated: # SECURITY.md nettytcnative = '2.0.61.Final' opencensus = "0.31.1" -protobuf = "3.22.3" +protobuf = "3.23.4" [libraries] android-annotations = "com.google.android:annotations:4.1.1.4" androidx-annotation = "androidx.annotation:annotation:1.6.0" -androidx-core = "androidx.core:core:1.10.0" +androidx-core = "androidx.core:core:1.10.1" androidx-lifecycle-common = "androidx.lifecycle:lifecycle-common:2.6.1" androidx-lifecycle-service = "androidx.lifecycle:lifecycle-service:2.6.1" androidx-test-core = "androidx.test:core:1.5.0" @@ -21,24 +31,26 @@ androidx-test-ext-junit = "androidx.test.ext:junit:1.1.5" androidx-test-rules = "androidx.test:rules:1.5.0" animalsniffer = "org.codehaus.mojo:animal-sniffer:1.23" animalsniffer-annotations = "org.codehaus.mojo:animal-sniffer-annotations:1.23" -auto-value = "com.google.auto.value:auto-value:1.10.1" -auto-value-annotations = "com.google.auto.value:auto-value-annotations:1.10.1" -checker-qual = "org.checkerframework:checker-qual:3.33.0" -checkstyle = "com.puppycrawl.tools:checkstyle:8.28" +auto-value = "com.google.auto.value:auto-value:1.10.2" +auto-value-annotations = "com.google.auto.value:auto-value-annotations:1.10.2" +checkstyle = "com.puppycrawl.tools:checkstyle:10.12.1" commons-math3 = "org.apache.commons:commons-math3:3.6.1" conscrypt = "org.conscrypt:conscrypt-openjdk-uber:2.5.2" cronet-api = "org.chromium.net:cronet-api:108.5359.79" cronet-embedded = "org.chromium.net:cronet-embedded:108.5359.79" -errorprone-annotations = "com.google.errorprone:error_prone_annotations:2.18.0" -errorprone-corejava8 = "com.google.errorprone:error_prone_core:2.10.0" -errorprone-core = "com.google.errorprone:error_prone_core:2.18.0" -google-api-protos = "com.google.api.grpc:proto-google-common-protos:2.17.0" +errorprone-annotations = "com.google.errorprone:error_prone_annotations:2.20.0" +errorprone-core = "com.google.errorprone:error_prone_core:2.20.0" +google-api-protos = "com.google.api.grpc:proto-google-common-protos:2.22.0" google-auth-credentials = { module = "com.google.auth:google-auth-library-credentials", version.ref = "googleauth" } google-auth-oauth2Http = { module = "com.google.auth:google-auth-library-oauth2-http", version.ref = "googleauth" } +# Release notes: https://cloud.google.com/logging/docs/release-notes +google-cloud-logging = "com.google.cloud:google-cloud-logging:3.15.5" gson = "com.google.code.gson:gson:2.10.1" guava = { module = "com.google.guava:guava", version.ref = "guava" } guava-betaChecker = "com.google.guava:guava-beta-checker:1.0" guava-testlib = { module = "com.google.guava:guava-testlib", version.ref = "guava" } +# JRE version is needed for projects where its a transitive dependency, f.e. gcp-observability. +# May be different from the -android version. guava-jre = "com.google.guava:guava:32.0.1-jre" hdrhistogram = "org.hdrhistogram:HdrHistogram:2.1.12" javax-annotation = "org.apache.tomcat:annotations-api:6.0.53" @@ -46,8 +58,11 @@ j2objc-annotations = " com.google.j2objc:j2objc-annotations:2.8" jetty-alpn-agent = "org.mortbay.jetty.alpn:jetty-alpn-agent:2.0.10" jsr305 = "com.google.code.findbugs:jsr305:3.0.2" junit = "junit:junit:4.13.2" -mockito-android = "org.mockito:mockito-android:3.12.4" -mockito-core = "org.mockito:mockito-core:3.12.4" +# Update notes / 2023-07-19 sergiitk: +# Couldn't update to 5.4.0, updated to the last in 4.x line. Version 5.x breaks some tests. +# Error log: https://github.com/grpc/grpc-java/pull/10359#issuecomment-1632834435 +mockito-android = "org.mockito:mockito-android:4.11.0" +mockito-core = "org.mockito:mockito-core:4.11.0" netty-codec-http2 = { module = "io.netty:netty-codec-http2", version.ref = "netty" } netty-handler-proxy = { module = "io.netty:netty-handler-proxy", version.ref = "netty" } netty-tcnative = { module = "io.netty:netty-tcnative-boringssl-static", version.ref = "nettytcnative" } @@ -55,7 +70,7 @@ netty-tcnative-classes = { module = "io.netty:netty-tcnative-classes", version.r netty-transport-epoll = { module = "io.netty:netty-transport-native-epoll", version.ref = "netty" } netty-unix-common = { module = "io.netty:netty-transport-native-unix-common", version.ref = "netty" } okhttp = "com.squareup.okhttp:okhttp:2.7.5" -okio = "com.squareup.okio:okio:1.17.5" +okio = "com.squareup.okio:okio:2.10.0" opencensus-api = { module = "io.opencensus:opencensus-api", version.ref = "opencensus" } opencensus-contrib-grpc-metrics = { module = "io.opencensus:opencensus-contrib-grpc-metrics", version.ref = "opencensus" } opencensus-exporter-stats-stackdriver = { module = "io.opencensus:opencensus-exporter-stats-stackdriver", version.ref = "opencensus" } @@ -68,10 +83,13 @@ protobuf-java-util = { module = "com.google.protobuf:protobuf-java-util", versio protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobuf" } protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protobuf" } re2j = "com.google.re2j:re2j:1.7" -# Compilation failed with 4.10.2 due to native graphics, or something. We don't -# use it, but it seemed the compiler felt it needed the definition -robolectric = "org.robolectric:robolectric:4.9.2" +robolectric = "org.robolectric:robolectric:4.10.3" signature-android = "net.sf.androidscents.signature:android-api-level-19:4.4.2_r4" signature-java = "org.codehaus.mojo.signature:java18:1.0" -# 1.1+ requires Java 8, but we still use Java 7 with grpc-context -truth = "com.google.truth:truth:1.0.1" +truth = "com.google.truth:truth:1.1.5" + +# Do not update: Pinned to the last version supporting Java 8. +# See https://checkstyle.sourceforge.io/releasenotes.html#Release_10.1 +checkstylejava8 = "com.puppycrawl.tools:checkstyle:9.3" +# See https://github.com/google/error-prone/releases/tag/v2.11.0 +errorprone-corejava8 = "com.google.errorprone:error_prone_core:2.10.0" diff --git a/inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java b/inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java index 1c2ac3df22..dd1028fde7 100644 --- a/inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java +++ b/inprocess/src/main/java/io/grpc/inprocess/InProcessTransport.java @@ -117,7 +117,7 @@ final class InProcessTransport implements ServerTransport, ConnectionClientTrans } throw new RuntimeException(e); } - }; + }; @GuardedBy("this") diff --git a/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java b/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java index aeb866b352..82c49b5813 100644 --- a/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java +++ b/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java @@ -1249,7 +1249,7 @@ public abstract class AbstractInteropTest { } catch (StatusRuntimeException ex) { assertEquals(Status.Code.DEADLINE_EXCEEDED, ex.getStatus().getCode()); assertThat(ex.getStatus().getDescription()) - .startsWith("ClientCall started after CallOptions deadline was exceeded"); + .startsWith("ClientCall started after CallOptions deadline was exceeded"); } // CensusStreamTracerModule record final status in the interceptor, thus is guaranteed to be @@ -1282,7 +1282,7 @@ public abstract class AbstractInteropTest { } catch (StatusRuntimeException ex) { assertEquals(Status.Code.DEADLINE_EXCEEDED, ex.getStatus().getCode()); assertThat(ex.getStatus().getDescription()) - .startsWith("ClientCall started after CallOptions deadline was exceeded"); + .startsWith("ClientCall started after CallOptions deadline was exceeded"); } if (metricsExpected()) { MetricsRecord clientStartRecord = clientStatsRecorder.pollRecord(5, TimeUnit.SECONDS); diff --git a/netty/src/jmh/java/io/grpc/netty/MethodDescriptorBenchmark.java b/netty/src/jmh/java/io/grpc/netty/MethodDescriptorBenchmark.java index 9212996718..96844016c5 100644 --- a/netty/src/jmh/java/io/grpc/netty/MethodDescriptorBenchmark.java +++ b/netty/src/jmh/java/io/grpc/netty/MethodDescriptorBenchmark.java @@ -38,16 +38,16 @@ public class MethodDescriptorBenchmark { private static final MethodDescriptor.Marshaller marshaller = new MethodDescriptor.Marshaller() { - @Override - public InputStream stream(Void value) { - return new ByteArrayInputStream(new byte[]{}); - } + @Override + public InputStream stream(Void value) { + return new ByteArrayInputStream(new byte[]{}); + } - @Override - public Void parse(InputStream stream) { - return null; - } - }; + @Override + public Void parse(InputStream stream) { + return null; + } + }; MethodDescriptor method = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) diff --git a/netty/src/main/java/io/grpc/netty/NettyServer.java b/netty/src/main/java/io/grpc/netty/NettyServer.java index 4c16ac50a2..fe7913870f 100644 --- a/netty/src/main/java/io/grpc/netty/NettyServer.java +++ b/netty/src/main/java/io/grpc/netty/NettyServer.java @@ -272,9 +272,7 @@ class NettyServer implements InternalServer, InternalWithLogId { transportListener = listener.transportCreated(transport); } - /** - * Releases the event loop if the channel is "done", possibly due to the channel closing. - */ + /* Releases the event loop if the channel is "done", possibly due to the channel closing. */ final class LoopReleaser implements ChannelFutureListener { private boolean done; diff --git a/netty/src/test/java/io/grpc/netty/NettyClientHandlerTest.java b/netty/src/test/java/io/grpc/netty/NettyClientHandlerTest.java index 6aa29dea6b..9cb2c043e5 100644 --- a/netty/src/test/java/io/grpc/netty/NettyClientHandlerTest.java +++ b/netty/src/test/java/io/grpc/netty/NettyClientHandlerTest.java @@ -185,8 +185,8 @@ public class NettyClientHandlerTest extends NettyHandlerTestBaseany()); + .when(streamListener) + .messagesAvailable(ArgumentMatchers.any()); lifecycleManager = new ClientTransportLifecycleManager(listener); // This mocks the keepalive manager only for there's in which we verify it. For other tests diff --git a/netty/src/test/java/io/grpc/netty/NettyClientStreamTest.java b/netty/src/test/java/io/grpc/netty/NettyClientStreamTest.java index 61525d8369..96551d173a 100644 --- a/netty/src/test/java/io/grpc/netty/NettyClientStreamTest.java +++ b/netty/src/test/java/io/grpc/netty/NettyClientStreamTest.java @@ -124,8 +124,8 @@ public class NettyClientStreamTest extends NettyStreamTestBaseany()); + .when(listener) + .messagesAvailable(ArgumentMatchers.any()); } @Override diff --git a/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java b/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java index 6ee9960995..368b0600f9 100644 --- a/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java +++ b/netty/src/test/java/io/grpc/netty/NettyServerHandlerTest.java @@ -179,8 +179,8 @@ public class NettyServerHandlerTest extends NettyHandlerTestBaseany()); + .when(serverListener) + .messagesAvailable(ArgumentMatchers.any()); } @Test diff --git a/okhttp/build.gradle b/okhttp/build.gradle index daaec3e6fd..5665c0ff8f 100644 --- a/okhttp/build.gradle +++ b/okhttp/build.gradle @@ -15,6 +15,12 @@ dependencies { libraries.perfmark.api // Make okhttp dependencies compile only compileOnly libraries.okhttp + + // Needed because com.google.guava:guava:32.0.1-android requires + // com.google.errorprone:error_prone_annotations version 2.18.0, while we are running newer. + // TODO(any release manager): remove when guava is updated + runtimeOnly libraries.errorprone.annotations + // Tests depend on base class defined by core module. testImplementation testFixtures(project(':grpc-core')), testFixtures(project(':grpc-api')), diff --git a/repositories.bzl b/repositories.bzl index 4ca172b30e..3408e2c6e7 100644 --- a/repositories.bzl +++ b/repositories.bzl @@ -11,20 +11,20 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # ) IO_GRPC_GRPC_JAVA_ARTIFACTS = [ "com.google.android:annotations:4.1.1.4", - "com.google.api.grpc:proto-google-common-protos:2.17.0", + "com.google.api.grpc:proto-google-common-protos:2.22.0", "com.google.auth:google-auth-library-credentials:1.4.0", "com.google.auth:google-auth-library-oauth2-http:1.4.0", - "com.google.auto.value:auto-value-annotations:1.10.1", - "com.google.auto.value:auto-value:1.10.1", + "com.google.auto.value:auto-value-annotations:1.10.2", + "com.google.auto.value:auto-value:1.10.2", "com.google.code.findbugs:jsr305:3.0.2", "com.google.code.gson:gson:2.10.1", - "com.google.errorprone:error_prone_annotations:2.18.0", + "com.google.errorprone:error_prone_annotations:2.20.0", "com.google.guava:failureaccess:1.0.1", "com.google.guava:guava:32.0.1-android", "com.google.re2j:re2j:1.7", - "com.google.truth:truth:1.0.1", + "com.google.truth:truth:1.1.5", "com.squareup.okhttp:okhttp:2.7.5", - "com.squareup.okio:okio:1.17.5", + "com.squareup.okio:okio:2.10.0", "io.netty:netty-buffer:4.1.94.Final", "io.netty:netty-codec-http2:4.1.94.Final", "io.netty:netty-codec-http:4.1.94.Final", @@ -143,18 +143,18 @@ def com_google_protobuf(): # This statement defines the @com_google_protobuf repo. http_archive( name = "com_google_protobuf", - sha256 = "5d0f05587aa3ad56079b4c4481dcb462267e5f1075d905c321f8ed6339e74ab0", - strip_prefix = "protobuf-22.3", - urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protobuf-22.3.zip"], + sha256 = "ac3fd4e97af55405d8bfba43c22d8a7e464a371bb6bc9e706627b745c1022dbf", + strip_prefix = "protobuf-23.4", + urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protobuf-23.4.zip"], ) def com_google_protobuf_javalite(): # java_lite_proto_library rules implicitly depend on @com_google_protobuf_javalite http_archive( name = "com_google_protobuf_javalite", - sha256 = "5d0f05587aa3ad56079b4c4481dcb462267e5f1075d905c321f8ed6339e74ab0", - strip_prefix = "protobuf-22.3", - urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protobuf-22.3.zip"], + sha256 = "ac3fd4e97af55405d8bfba43c22d8a7e464a371bb6bc9e706627b745c1022dbf", + strip_prefix = "protobuf-23.4", + urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protobuf-23.4.zip"], ) def io_grpc_grpc_proto(): diff --git a/xds/src/main/java/io/grpc/xds/ControlPlaneClient.java b/xds/src/main/java/io/grpc/xds/ControlPlaneClient.java index 5a3400c751..c919365d09 100644 --- a/xds/src/main/java/io/grpc/xds/ControlPlaneClient.java +++ b/xds/src/main/java/io/grpc/xds/ControlPlaneClient.java @@ -383,8 +383,9 @@ final class ControlPlaneClient { void start() { AggregatedDiscoveryServiceGrpc.AggregatedDiscoveryServiceStub stub = AggregatedDiscoveryServiceGrpc.newStub(channel); - StreamObserver responseReader = - new ClientResponseObserver() { + + final class AdsClientResponseObserver + implements ClientResponseObserver { @Override public void beforeStart(ClientCallStreamObserver requestStream) { @@ -434,8 +435,9 @@ final class ControlPlaneClient { } }); } - }; - requestWriter = stub.streamAggregatedResources(responseReader); + } + + requestWriter = stub.streamAggregatedResources(new AdsClientResponseObserver()); } @Override diff --git a/xds/src/main/java/io/grpc/xds/internal/security/certprovider/CertificateProviderRegistry.java b/xds/src/main/java/io/grpc/xds/internal/security/certprovider/CertificateProviderRegistry.java index 2c320b7996..f8ced7bb2c 100644 --- a/xds/src/main/java/io/grpc/xds/internal/security/certprovider/CertificateProviderRegistry.java +++ b/xds/src/main/java/io/grpc/xds/internal/security/certprovider/CertificateProviderRegistry.java @@ -59,7 +59,7 @@ public final class CertificateProviderRegistry { * Deregisters a provider. No-op if the provider is not in the registry. * * @param certificateProviderProvider the provider that was added to the registry via - * {@link #register}. + * {@link #register}. */ public synchronized void deregister(CertificateProviderProvider certificateProviderProvider) { checkNotNull(certificateProviderProvider, "certificateProviderProvider"); diff --git a/xds/src/main/java/io/grpc/xds/internal/security/trust/CertificateUtils.java b/xds/src/main/java/io/grpc/xds/internal/security/trust/CertificateUtils.java index 6e244a438c..d7696bbd3a 100644 --- a/xds/src/main/java/io/grpc/xds/internal/security/trust/CertificateUtils.java +++ b/xds/src/main/java/io/grpc/xds/internal/security/trust/CertificateUtils.java @@ -49,9 +49,9 @@ public final class CertificateUtils { private static CertificateFactory factory; private static final Pattern KEY_PATTERN = Pattern.compile( - "-+BEGIN\\s+.*PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+" + // Header - "([a-z0-9+/=\\r\\n]+)" + // Base64 text - "-+END\\s+.*PRIVATE\\s+KEY[^-]*-+", // Footer + "-+BEGIN\\s+.*PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+" // Header + + "([a-z0-9+/=\\r\\n]+)" // Base64 text + + "-+END\\s+.*PRIVATE\\s+KEY[^-]*-+", // Footer Pattern.CASE_INSENSITIVE); private static synchronized void initInstance() throws CertificateException { diff --git a/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java b/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java index 604dd57b5c..81a23d2b5f 100644 --- a/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java +++ b/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java @@ -153,13 +153,13 @@ public class ClusterResolverLoadBalancerTest { private final NameResolverRegistry nsRegistry = new NameResolverRegistry(); private final PolicySelection roundRobin = new PolicySelection( new FakeLoadBalancerProvider("wrr_locality_experimental"), new WrrLocalityConfig( - new PolicySelection(new FakeLoadBalancerProvider("round_robin"), null))); + new PolicySelection(new FakeLoadBalancerProvider("round_robin"), null))); private final PolicySelection ringHash = new PolicySelection( new FakeLoadBalancerProvider("ring_hash_experimental"), new RingHashConfig(10L, 100L)); private final PolicySelection leastRequest = new PolicySelection( new FakeLoadBalancerProvider("wrr_locality_experimental"), new WrrLocalityConfig( - new PolicySelection(new FakeLoadBalancerProvider("least_request_experimental"), - new LeastRequestConfig(3)))); + new PolicySelection(new FakeLoadBalancerProvider("least_request_experimental"), + new LeastRequestConfig(3)))); private final List childBalancers = new ArrayList<>(); private final List resolvers = new ArrayList<>(); private final FakeXdsClient xdsClient = new FakeXdsClient(); diff --git a/xds/src/test/java/io/grpc/xds/XdsTestControlPlaneService.java b/xds/src/test/java/io/grpc/xds/XdsTestControlPlaneService.java index d7ac5bdd3c..c51327dc84 100644 --- a/xds/src/test/java/io/grpc/xds/XdsTestControlPlaneService.java +++ b/xds/src/test/java/io/grpc/xds/XdsTestControlPlaneService.java @@ -122,8 +122,8 @@ final class XdsTestControlPlaneService extends @Override public StreamObserver streamAggregatedResources( final StreamObserver responseObserver) { - final StreamObserver requestObserver = - new StreamObserver() { + + final class AdsStreamObserver implements StreamObserver { @Override public void onNext(final DiscoveryRequest value) { syncContext.execute(new Runnable() { @@ -176,8 +176,9 @@ final class XdsTestControlPlaneService extends xdsNonces.get(type).remove(responseObserver); } } - }; - return requestObserver; + } + + return new AdsStreamObserver(); } //must run in syncContext diff --git a/xds/src/test/java/io/grpc/xds/internal/security/SecurityProtocolNegotiatorsTest.java b/xds/src/test/java/io/grpc/xds/internal/security/SecurityProtocolNegotiatorsTest.java index 8a4123d54a..753bc96708 100644 --- a/xds/src/test/java/io/grpc/xds/internal/security/SecurityProtocolNegotiatorsTest.java +++ b/xds/src/test/java/io/grpc/xds/internal/security/SecurityProtocolNegotiatorsTest.java @@ -233,7 +233,7 @@ public class SecurityProtocolNegotiatorsTest { ProtocolNegotiationEvent event = InternalProtocolNegotiationEvent.getDefault(); Attributes attr = InternalProtocolNegotiationEvent.getAttributes(event) .toBuilder().set(ATTR_SERVER_SSL_CONTEXT_PROVIDER_SUPPLIER, - new SslContextProviderSupplier(downstreamTlsContext, tlsContextManager)).build(); + new SslContextProviderSupplier(downstreamTlsContext, tlsContextManager)).build(); pipeline.fireUserEventTriggered(InternalProtocolNegotiationEvent.withAttributes(event, attr)); channelHandlerCtx = pipeline.context(handlerPickerHandler); assertThat(channelHandlerCtx).isNull(); diff --git a/xds/src/test/java/io/grpc/xds/orca/OrcaMetricReportingServerInterceptorTest.java b/xds/src/test/java/io/grpc/xds/orca/OrcaMetricReportingServerInterceptorTest.java index 469cd9363a..ec56467e5a 100644 --- a/xds/src/test/java/io/grpc/xds/orca/OrcaMetricReportingServerInterceptorTest.java +++ b/xds/src/test/java/io/grpc/xds/orca/OrcaMetricReportingServerInterceptorTest.java @@ -137,8 +137,8 @@ public class OrcaMetricReportingServerInterceptorTest { @Test public void shareCallMetricRecorderInContext() throws IOException { final CallMetricRecorder callMetricRecorder = new CallMetricRecorder(); - ServerStreamTracer.Factory callMetricRecorderSharingStreamTracerFactory = - new ServerStreamTracer.Factory() { + ServerStreamTracer.Factory callMetricRecorderSharingStreamTracerFactory; + callMetricRecorderSharingStreamTracerFactory = new ServerStreamTracer.Factory() { @Override public ServerStreamTracer newServerStreamTracer(String fullMethodName, Metadata headers) { return new ServerStreamTracer() {