Add proper generics to ManagedChannelProvider

This commit is contained in:
Carl Mastrangelo 2015-09-09 13:31:09 -07:00
parent 23e6318156
commit e969a900a0
3 changed files with 3 additions and 5 deletions

View File

@ -31,8 +31,6 @@
package io.grpc; package io.grpc;
import io.grpc.ManagedChannelProvider;
import java.util.List; import java.util.List;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
@ -42,7 +40,7 @@ import java.util.concurrent.Executor;
* @param <T> The concrete type of this builder. * @param <T> The concrete type of this builder.
*/ */
public abstract class ManagedChannelBuilder<T extends ManagedChannelBuilder<T>> { public abstract class ManagedChannelBuilder<T extends ManagedChannelBuilder<T>> {
public static ManagedChannelBuilder forAddress(String name, int port) { public static ManagedChannelBuilder<?> forAddress(String name, int port) {
return ManagedChannelProvider.provider().builderForAddress(name, port); return ManagedChannelProvider.provider().builderForAddress(name, port);
} }

View File

@ -104,7 +104,7 @@ public abstract class ManagedChannelProvider {
/** /**
* Creates a new builder with the given host and port. * Creates a new builder with the given host and port.
*/ */
protected abstract ManagedChannelBuilder builderForAddress(String name, int port); protected abstract ManagedChannelBuilder<?> builderForAddress(String name, int port);
public static final class ProviderNotFoundException extends RuntimeException { public static final class ProviderNotFoundException extends RuntimeException {
public ProviderNotFoundException(String msg) { public ProviderNotFoundException(String msg) {

View File

@ -110,7 +110,7 @@ public class ManagedChannelProviderTest {
} }
@Override @Override
protected ManagedChannelBuilder builderForAddress(String host, int port) { protected ManagedChannelBuilder<?> builderForAddress(String host, int port) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
} }