Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Unified Diff: mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl

Issue 692823003: java: Fix findbugs errors on generated code. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
index feeeab28532f072ed654688aa601e65771ae72f4..cfc66915e92648d2efc718a756657b8323c36801 100644
--- a/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/java_templates/struct_definition.tmpl
@@ -187,11 +187,13 @@ if (decoder{{level+1}} == null) {
return false;
if (getClass() != object.getClass())
return false;
+{% if struct.fields|length %}
{{struct|name}} other = ({{struct|name}}) object;
-{% for field in struct.fields %}
+{% for field in struct.fields %}
if ({{inequality(field.kind, field|name, 'other.'~field|name)}})
return false;
-{% endfor %}
+{% endfor %}
+{% endif %}
return true;
}
@@ -201,7 +203,7 @@ if (decoder{{level+1}} == null) {
@Override
public int hashCode() {
final int prime = 31;
- int result = 1;
+ int result = prime + getClass().hashCode();
{% for field in struct.fields %}
result = prime * result + {{hash(field.kind, field|name)}};
{% endfor %}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698