diff --git a/api/src/main/java/io/grpc/Attributes.java b/api/src/main/java/io/grpc/Attributes.java index 9063e6e7c8..cadafece3e 100644 --- a/api/src/main/java/io/grpc/Attributes.java +++ b/api/src/main/java/io/grpc/Attributes.java @@ -252,7 +252,7 @@ public final class Attributes { return this; } - public Builder setAll(Attributes other) { + public Builder setAll(Attributes other) { data(other.data.size()).putAll(other.data); return this; } diff --git a/api/src/main/java/io/grpc/InternalMethodDescriptor.java b/api/src/main/java/io/grpc/InternalMethodDescriptor.java index 9ffc188087..23bb039e0f 100644 --- a/api/src/main/java/io/grpc/InternalMethodDescriptor.java +++ b/api/src/main/java/io/grpc/InternalMethodDescriptor.java @@ -30,11 +30,11 @@ public final class InternalMethodDescriptor { this.transport = checkNotNull(transport, "transport"); } - public Object geRawMethodName(MethodDescriptor md) { - return md.getRawMethodName(transport.ordinal()); + public Object geRawMethodName(MethodDescriptor descriptor) { + return descriptor.getRawMethodName(transport.ordinal()); } - public void setRawMethodName(MethodDescriptor md, Object o) { - md.setRawMethodName(transport.ordinal(), o); + public void setRawMethodName(MethodDescriptor descriptor, Object o) { + descriptor.setRawMethodName(transport.ordinal(), o); } } diff --git a/api/src/main/java/io/grpc/NameResolverRegistry.java b/api/src/main/java/io/grpc/NameResolverRegistry.java index fe97f828d0..2e914e2fbc 100644 --- a/api/src/main/java/io/grpc/NameResolverRegistry.java +++ b/api/src/main/java/io/grpc/NameResolverRegistry.java @@ -86,8 +86,8 @@ public final class NameResolverRegistry { // sort() must be stable, as we prefer first-registered providers Collections.sort(providers, Collections.reverseOrder(new Comparator() { @Override - public int compare(NameResolverProvider p1, NameResolverProvider p2) { - return p1.priority() - p2.priority(); + public int compare(NameResolverProvider o1, NameResolverProvider o2) { + return o1.priority() - o2.priority(); } })); effectiveProviders = Collections.unmodifiableList(providers); diff --git a/protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoLiteUtils.java b/protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoLiteUtils.java index 326e4ee895..ddba5b8d5b 100644 --- a/protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoLiteUtils.java +++ b/protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoLiteUtils.java @@ -97,8 +97,8 @@ public final class ProtoLiteUtils { /** Copies the data from input stream to output stream. */ static long copy(InputStream from, OutputStream to) throws IOException { // Copied from guava com.google.common.io.ByteStreams because its API is unstable (beta) - checkNotNull(from); - checkNotNull(to); + checkNotNull(from, "inputStream cannot be null!"); + checkNotNull(to, "outputStream cannot be null!"); byte[] buf = new byte[BUF_SIZE]; long total = 0; while (true) { @@ -162,7 +162,7 @@ public final class ProtoLiteUtils { @SuppressWarnings("unchecked") T message = (T) ((ProtoInputStream) stream).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 // optimization is to be transparent, instead of throwing an error we'll continue, // even though it seems likely there's a bug.