Skip to content

Commit

Permalink
core: Deprecate ForwardingChannelBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiitk committed Nov 1, 2023
1 parent 84ddcb0 commit 883fb0e
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions alts/src/main/java/io/grpc/alts/AltsChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.google.common.annotations.VisibleForTesting;
import io.grpc.ExperimentalApi;
import io.grpc.ForwardingChannelBuilder;
import io.grpc.ForwardingChannelBuilder2;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.internal.GrpcUtil;
Expand All @@ -32,7 +32,7 @@
* commmunication between two cloud VMs using ALTS.
*/
@ExperimentalApi("/~https://github.com/grpc/grpc-java/issues/4151")
public final class AltsChannelBuilder extends ForwardingChannelBuilder<AltsChannelBuilder> {
public final class AltsChannelBuilder extends ForwardingChannelBuilder2<AltsChannelBuilder> {
private final NettyChannelBuilder delegate;
private final AltsChannelCredentials.Builder credentialsBuilder =
new AltsChannelCredentials.Builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package io.grpc.alts;

import io.grpc.ForwardingChannelBuilder;
import io.grpc.ForwardingChannelBuilder2;
import io.grpc.ManagedChannelBuilder;
import io.grpc.internal.GrpcUtil;
import io.grpc.netty.NettyChannelBuilder;
Expand All @@ -26,7 +26,7 @@
* using ALTS if applicable and using TLS as fallback.
*/
public final class ComputeEngineChannelBuilder
extends ForwardingChannelBuilder<ComputeEngineChannelBuilder> {
extends ForwardingChannelBuilder2<ComputeEngineChannelBuilder> {

private final NettyChannelBuilder delegate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package io.grpc.alts;

import io.grpc.ForwardingChannelBuilder;
import io.grpc.ForwardingChannelBuilder2;
import io.grpc.ManagedChannelBuilder;
import io.grpc.internal.GrpcUtil;
import io.grpc.netty.NettyChannelBuilder;
Expand All @@ -26,7 +26,7 @@
* using ALTS if applicable and using TLS as fallback.
*/
public final class GoogleDefaultChannelBuilder
extends ForwardingChannelBuilder<GoogleDefaultChannelBuilder> {
extends ForwardingChannelBuilder2<GoogleDefaultChannelBuilder> {

private final NettyChannelBuilder delegate;

Expand Down
4 changes: 2 additions & 2 deletions api/src/main/java/io/grpc/ForwardingChannelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
*
* @param <T> The type of the subclass extending this abstract class.
* @since 1.7.0
* @deprecated Use {@link ForwardingChannelBuilder2} instead.
*/
@Deprecated
public abstract class ForwardingChannelBuilder<T extends ForwardingChannelBuilder<T>>
extends ForwardingChannelBuilder2<T> {
// TODO(sergiitk): deprecate after stabilizing

/**
* The default constructor.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* Unit tests for {@link ForwardingChannelBuilder}.
*/
@RunWith(JUnit4.class)
@SuppressWarnings("deprecation")
public class ForwardingChannelBuilderTest {
private final ManagedChannelBuilder<?> mockDelegate = mock(ManagedChannelBuilder.class);

Expand Down
10 changes: 5 additions & 5 deletions api/src/test/java/io/grpc/ManagedChannelRegistryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public NewChannelBuilderResult newChannelBuilder(
return NewChannelBuilderResult.error("dodging");
}
});
class MockChannelBuilder extends ForwardingChannelBuilder<MockChannelBuilder> {
class MockChannelBuilder extends ForwardingChannelBuilder2<MockChannelBuilder> {
@Override public ManagedChannelBuilder<?> delegate() {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -199,7 +199,7 @@ public NewChannelBuilderResult newChannelBuilder(
throw new AssertionError();
}
});
class MockChannelBuilder extends ForwardingChannelBuilder<MockChannelBuilder> {
class MockChannelBuilder extends ForwardingChannelBuilder2<MockChannelBuilder> {
@Override public ManagedChannelBuilder<?> delegate() {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -282,7 +282,7 @@ public void newChannelBuilder_emptySet_asDefault() {
NameResolverRegistry nameResolverRegistry = new NameResolverRegistry();

ManagedChannelRegistry registry = new ManagedChannelRegistry();
class MockChannelBuilder extends ForwardingChannelBuilder<MockChannelBuilder> {
class MockChannelBuilder extends ForwardingChannelBuilder2<MockChannelBuilder> {
@Override public ManagedChannelBuilder<?> delegate() {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -320,7 +320,7 @@ protected Collection<Class<? extends SocketAddress>> getProducedSocketAddressTyp
});

ManagedChannelRegistry registry = new ManagedChannelRegistry();
class MockChannelBuilder extends ForwardingChannelBuilder<MockChannelBuilder> {
class MockChannelBuilder extends ForwardingChannelBuilder2<MockChannelBuilder> {
@Override public ManagedChannelBuilder<?> delegate() {
throw new UnsupportedOperationException();
}
Expand Down Expand Up @@ -351,7 +351,7 @@ class SocketAddress1 extends SocketAddress {

ManagedChannelRegistry registry = new ManagedChannelRegistry();

class MockChannelBuilder extends ForwardingChannelBuilder<MockChannelBuilder> {
class MockChannelBuilder extends ForwardingChannelBuilder2<MockChannelBuilder> {
@Override public ManagedChannelBuilder<?> delegate() {
throw new UnsupportedOperationException();
}
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/io/grpc/internal/ManagedChannelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import io.grpc.Deadline;
import io.grpc.DecompressorRegistry;
import io.grpc.EquivalentAddressGroup;
import io.grpc.ForwardingChannelBuilder;
import io.grpc.ForwardingChannelBuilder2;
import io.grpc.ForwardingClientCall;
import io.grpc.Grpc;
import io.grpc.InternalChannelz;
Expand Down Expand Up @@ -1593,7 +1593,7 @@ public ManagedChannelBuilder<?> createResolvingOobChannelBuilder(
checkNotNull(channelCreds, "channelCreds");

final class ResolvingOobChannelBuilder
extends ForwardingChannelBuilder<ResolvingOobChannelBuilder> {
extends ForwardingChannelBuilder2<ResolvingOobChannelBuilder> {
final ManagedChannelBuilder<?> delegate;

ResolvingOobChannelBuilder() {
Expand Down
4 changes: 2 additions & 2 deletions rls/src/test/java/io/grpc/rls/CachingRlsLbClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import io.grpc.ChannelLogger;
import io.grpc.ConnectivityState;
import io.grpc.EquivalentAddressGroup;
import io.grpc.ForwardingChannelBuilder;
import io.grpc.ForwardingChannelBuilder2;
import io.grpc.LoadBalancer;
import io.grpc.LoadBalancer.Helper;
import io.grpc.LoadBalancer.PickResult;
Expand Down Expand Up @@ -817,7 +817,7 @@ public ManagedChannelBuilder<?> createResolvingOobChannelBuilder(
final InProcessChannelBuilder builder =
InProcessChannelBuilder.forName(target).directExecutor();

class CleaningChannelBuilder extends ForwardingChannelBuilder<CleaningChannelBuilder> {
class CleaningChannelBuilder extends ForwardingChannelBuilder2<CleaningChannelBuilder> {

@Override
protected ManagedChannelBuilder<?> delegate() {
Expand Down
4 changes: 2 additions & 2 deletions rls/src/test/java/io/grpc/rls/RlsLoadBalancerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import io.grpc.ConnectivityState;
import io.grpc.ConnectivityStateInfo;
import io.grpc.EquivalentAddressGroup;
import io.grpc.ForwardingChannelBuilder;
import io.grpc.ForwardingChannelBuilder2;
import io.grpc.LoadBalancer.CreateSubchannelArgs;
import io.grpc.LoadBalancer.Helper;
import io.grpc.LoadBalancer.PickResult;
Expand Down Expand Up @@ -519,7 +519,7 @@ public ManagedChannelBuilder<?> createResolvingOobChannelBuilder(
final InProcessChannelBuilder builder =
InProcessChannelBuilder.forName(target).directExecutor();

class CleaningChannelBuilder extends ForwardingChannelBuilder<CleaningChannelBuilder> {
class CleaningChannelBuilder extends ForwardingChannelBuilder2<CleaningChannelBuilder> {

@Override
protected ManagedChannelBuilder<?> delegate() {
Expand Down

0 comments on commit 883fb0e

Please sign in to comment.