mirror of https://github.com/grpc/grpc-java.git
api,protobuf-lite: solve code style issues
This commit is contained in:
parent
c6c2ee876a
commit
e526891a2b
|
|
@ -252,7 +252,7 @@ public final class Attributes {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T> Builder setAll(Attributes other) {
|
public Builder setAll(Attributes other) {
|
||||||
data(other.data.size()).putAll(other.data);
|
data(other.data.size()).putAll(other.data);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ public final class InternalMethodDescriptor {
|
||||||
this.transport = checkNotNull(transport, "transport");
|
this.transport = checkNotNull(transport, "transport");
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object geRawMethodName(MethodDescriptor<?, ?> md) {
|
public Object geRawMethodName(MethodDescriptor<?, ?> descriptor) {
|
||||||
return md.getRawMethodName(transport.ordinal());
|
return descriptor.getRawMethodName(transport.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRawMethodName(MethodDescriptor<?, ?> md, Object o) {
|
public void setRawMethodName(MethodDescriptor<?, ?> descriptor, Object o) {
|
||||||
md.setRawMethodName(transport.ordinal(), o);
|
descriptor.setRawMethodName(transport.ordinal(), o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,8 @@ public final class NameResolverRegistry {
|
||||||
// sort() must be stable, as we prefer first-registered providers
|
// sort() must be stable, as we prefer first-registered providers
|
||||||
Collections.sort(providers, Collections.reverseOrder(new Comparator<NameResolverProvider>() {
|
Collections.sort(providers, Collections.reverseOrder(new Comparator<NameResolverProvider>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(NameResolverProvider p1, NameResolverProvider p2) {
|
public int compare(NameResolverProvider o1, NameResolverProvider o2) {
|
||||||
return p1.priority() - p2.priority();
|
return o1.priority() - o2.priority();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
effectiveProviders = Collections.unmodifiableList(providers);
|
effectiveProviders = Collections.unmodifiableList(providers);
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,8 @@ public final class ProtoLiteUtils {
|
||||||
/** Copies the data from input stream to output stream. */
|
/** Copies the data from input stream to output stream. */
|
||||||
static long copy(InputStream from, OutputStream to) throws IOException {
|
static long copy(InputStream from, OutputStream to) throws IOException {
|
||||||
// Copied from guava com.google.common.io.ByteStreams because its API is unstable (beta)
|
// Copied from guava com.google.common.io.ByteStreams because its API is unstable (beta)
|
||||||
checkNotNull(from);
|
checkNotNull(from, "inputStream cannot be null!");
|
||||||
checkNotNull(to);
|
checkNotNull(to, "outputStream cannot be null!");
|
||||||
byte[] buf = new byte[BUF_SIZE];
|
byte[] buf = new byte[BUF_SIZE];
|
||||||
long total = 0;
|
long total = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
@ -162,7 +162,7 @@ public final class ProtoLiteUtils {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
T message = (T) ((ProtoInputStream) stream).message();
|
T message = (T) ((ProtoInputStream) stream).message();
|
||||||
return message;
|
return message;
|
||||||
} catch (IllegalStateException ex) {
|
} catch (IllegalStateException ignored) {
|
||||||
// Stream must have been read from, which is a strange state. Since the point of this
|
// Stream must have been read from, which is a strange state. Since the point of this
|
||||||
// optimization is to be transparent, instead of throwing an error we'll continue,
|
// optimization is to be transparent, instead of throwing an error we'll continue,
|
||||||
// even though it seems likely there's a bug.
|
// even though it seems likely there's a bug.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue