Fix for issue #2117

This change adds `this` to field names in `equals` within `pojo.mustache` so that an incorrect `equals` method is not generated in cases where a class has an internal field that is the same as the `classVarName` of the class.
This commit is contained in:
Vivin Paliath
2016-02-16 09:07:47 -07:00
parent a47cdddbeb
commit 04c1940343

View File

@@ -41,7 +41,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
}
{{classname}} {{classVarName}} = ({{classname}}) o;
return true {{#hasVars}}&& {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
return true {{#hasVars}}&& {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{/vars}}{{/hasVars}}
{{#parent}}&& super.equals(o){{/parent}};
}