Skip to content

Commit e526891

Browse files
manuelkolluscarl-mastrangelo
authored andcommitted
api,protobuf-lite: solve code style issues
1 parent c6c2ee8 commit e526891

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

api/src/main/java/io/grpc/Attributes.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public <T> Builder discard(Key<T> key) {
252252
return this;
253253
}
254254

255-
public <T> Builder setAll(Attributes other) {
255+
public Builder setAll(Attributes other) {
256256
data(other.data.size()).putAll(other.data);
257257
return this;
258258
}

api/src/main/java/io/grpc/InternalMethodDescriptor.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ public InternalMethodDescriptor(InternalKnownTransport transport) {
3030
this.transport = checkNotNull(transport, "transport");
3131
}
3232

33-
public Object geRawMethodName(MethodDescriptor<?, ?> md) {
34-
return md.getRawMethodName(transport.ordinal());
33+
public Object geRawMethodName(MethodDescriptor<?, ?> descriptor) {
34+
return descriptor.getRawMethodName(transport.ordinal());
3535
}
3636

37-
public void setRawMethodName(MethodDescriptor<?, ?> md, Object o) {
38-
md.setRawMethodName(transport.ordinal(), o);
37+
public void setRawMethodName(MethodDescriptor<?, ?> descriptor, Object o) {
38+
descriptor.setRawMethodName(transport.ordinal(), o);
3939
}
4040
}

api/src/main/java/io/grpc/NameResolverRegistry.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ private synchronized void refreshProviders() {
8686
// sort() must be stable, as we prefer first-registered providers
8787
Collections.sort(providers, Collections.reverseOrder(new Comparator<NameResolverProvider>() {
8888
@Override
89-
public int compare(NameResolverProvider p1, NameResolverProvider p2) {
90-
return p1.priority() - p2.priority();
89+
public int compare(NameResolverProvider o1, NameResolverProvider o2) {
90+
return o1.priority() - o2.priority();
9191
}
9292
}));
9393
effectiveProviders = Collections.unmodifiableList(providers);

protobuf-lite/src/main/java/io/grpc/protobuf/lite/ProtoLiteUtils.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ public static <T extends MessageLite> Metadata.BinaryMarshaller<T> metadataMarsh
9797
/** Copies the data from input stream to output stream. */
9898
static long copy(InputStream from, OutputStream to) throws IOException {
9999
// Copied from guava com.google.common.io.ByteStreams because its API is unstable (beta)
100-
checkNotNull(from);
101-
checkNotNull(to);
100+
checkNotNull(from, "inputStream cannot be null!");
101+
checkNotNull(to, "outputStream cannot be null!");
102102
byte[] buf = new byte[BUF_SIZE];
103103
long total = 0;
104104
while (true) {
@@ -162,7 +162,7 @@ public T parse(InputStream stream) {
162162
@SuppressWarnings("unchecked")
163163
T message = (T) ((ProtoInputStream) stream).message();
164164
return message;
165-
} catch (IllegalStateException ex) {
165+
} catch (IllegalStateException ignored) {
166166
// Stream must have been read from, which is a strange state. Since the point of this
167167
// optimization is to be transparent, instead of throwing an error we'll continue,
168168
// even though it seems likely there's a bug.

0 commit comments

Comments
 (0)