mirror of https://github.com/grpc/grpc-java.git
stub: Add @InlineMe to deprecated gRPC APIs (#8457)
Read more @ https://errorprone.info/docs/inlineme
This commit is contained in:
parent
0f6380b470
commit
f3337f28ce
|
@ -8,6 +8,7 @@ java_library(
|
|||
"//api",
|
||||
"//context",
|
||||
"@com_google_code_findbugs_jsr305//jar",
|
||||
"@com_google_errorprone_error_prone_annotations//jar",
|
||||
"@com_google_guava_guava//jar",
|
||||
"@com_google_j2objc_j2objc_annotations//jar",
|
||||
],
|
||||
|
|
|
@ -10,6 +10,7 @@ description = "gRPC: Stub"
|
|||
dependencies {
|
||||
api project(':grpc-api'),
|
||||
libraries.guava
|
||||
implementation libraries.errorprone
|
||||
testImplementation libraries.truth,
|
||||
project(':grpc-testing')
|
||||
signature "org.codehaus.mojo.signature:java17:1.0@signature"
|
||||
|
|
|
@ -18,6 +18,7 @@ package io.grpc.stub;
|
|||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.errorprone.annotations.InlineMe;
|
||||
import io.grpc.CallOptions;
|
||||
import io.grpc.Channel;
|
||||
import io.grpc.ClientCall;
|
||||
|
@ -47,6 +48,10 @@ public final class MetadataUtils {
|
|||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
|
||||
@Deprecated
|
||||
@InlineMe(
|
||||
replacement =
|
||||
"stub.withInterceptors(MetadataUtils.newAttachHeadersInterceptor(extraHeaders))",
|
||||
imports = "io.grpc.stub.MetadataUtils")
|
||||
public static <T extends AbstractStub<T>> T attachHeaders(T stub, Metadata extraHeaders) {
|
||||
return stub.withInterceptors(newAttachHeadersInterceptor(extraHeaders));
|
||||
}
|
||||
|
@ -104,6 +109,11 @@ public final class MetadataUtils {
|
|||
*/
|
||||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1789")
|
||||
@Deprecated
|
||||
@InlineMe(
|
||||
replacement =
|
||||
"stub.withInterceptors(MetadataUtils.newCaptureMetadataInterceptor(headersCapture,"
|
||||
+ " trailersCapture))",
|
||||
imports = "io.grpc.stub.MetadataUtils")
|
||||
public static <T extends AbstractStub<T>> T captureMetadata(
|
||||
T stub,
|
||||
AtomicReference<Metadata> headersCapture,
|
||||
|
|
Loading…
Reference in New Issue