Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
[gapic-generator] fix: fix errorprone bazel errors (#3250)
Browse files Browse the repository at this point in the history
* fix: fix errorprone bazel errors

* fix: google-java-format
  • Loading branch information
miraleung committed Jul 14, 2020
1 parent 965504d commit f1381f9
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ public boolean equals(Object o) {
return o instanceof DiscoApiModel && ((DiscoApiModel) o).document.equals(document);
}

@Override
public int hashCode() {
return 19 * document.hashCode();
}

public String getDefaultPackageName() {
return defaultPackageName;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,9 @@ public boolean equals(Object o) {
&& ((DiscoInterfaceModel) o).interfaceName.equals(interfaceName)
&& ((DiscoInterfaceModel) o).apiModel.equals(apiModel);
}

@Override
public int hashCode() {
return 17 * interfaceName.hashCode() + 31 * apiModel.hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ public boolean equals(Object o) {
return o instanceof DiscoveryMethodModel && ((DiscoveryMethodModel) o).method.equals(method);
}

@Override
public int hashCode() {
return 17 * method.hashCode();
}

@Override
public String getSimpleName() {
return DiscoGapicParser.methodAsName(method).toLowerCamel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,9 @@ private List<TypeRef> getTypes(Model model) {
public boolean equals(Object o) {
return o instanceof ProtoApiModel && ((ProtoApiModel) o).protoModel.equals(protoModel);
}

@Override
public int hashCode() {
return 17 * protoModel.hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,9 @@ public boolean equals(Object o) {
return o instanceof ProtoInterfaceModel
&& ((ProtoInterfaceModel) o).protoInterface.equals(this.protoInterface);
}

@Override
public int hashCode() {
return 19 * protoInterface.hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public boolean equals(Object o) {
return o instanceof ProtoMethodModel && ((ProtoMethodModel) o).method.equals(method);
}

@Override
public int hashCode() {
return 19 * method.hashCode();
}

@Override
public Name asName() {
return Name.upperCamel(method.getSimpleName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private CodeGeneratorResponse writeCodeGenOutputToProtoc(Map<String, ?> outputFi
} else if (value instanceof String) {
outputStream.append((String) value);
} else if (value instanceof byte[]) {
outputStream.append((byte[]) value);
// outputStream.append((byte[]) value);
} else {
throw new IllegalArgumentException("Expected one of Doc, String, or byte[]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public static ConfigSource read(
Map<String, Message> supportedConfigTypes) {
Preconditions.checkArgument(
inputNames.size() == inputs.size(),
"size() of inputNames and inputs not equal: %d != %d",
inputNames.size(),
inputs.size());
String.format(
"size() of inputNames and inputs not equal: %d != %d",
inputNames.size(), inputs.size()));
ConfigSource.Builder sourceBuilder = null;
for (int i = 0; i < inputs.size(); i++) {
String inputName = inputNames.get(i);
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/google/api/codegen/util/Scanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public int scan() {
if (escaped) {
Integer esc = ESCAPES.get(codePoint);
Preconditions.checkArgument(
esc != null, "unrecognized escape '\\%c': %s", (char) codePoint, input);
esc != null,
String.format("unrecognized escape '\\%c': %s", (char) codePoint, input));
escaped = false;
sb.appendCodePoint(esc);
loc += Character.charCount(esc);
Expand Down

0 comments on commit f1381f9

Please sign in to comment.