forked from loafle/openapi-generator-original
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:
@@ -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}};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user