From 16da907acc6b4298672055b6f8b7a70155b61e4e Mon Sep 17 00:00:00 2001 From: Tim Smyth <33017641+pulledtim@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:29:56 +0200 Subject: [PATCH] Include parents hashCode, fix #325 (#326) * Include parents hashCode * PR remarks --- gen/main/java/issue/_315/ServiceScopesEntry.java | 2 +- .../java/testmodel/micronaut_pojo/InheritanceWithEnumType3.java | 2 +- .../micronaut_pojo_nullable/InheritanceWithEnumType3.java | 2 +- .../java/testmodel/nomicronaut/InheritanceWithEnumType3.java | 2 +- src/main/resources/Micronaut/modelPojo.mustache | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gen/main/java/issue/_315/ServiceScopesEntry.java b/gen/main/java/issue/_315/ServiceScopesEntry.java index f861b99d..0a4f0932 100644 --- a/gen/main/java/issue/_315/ServiceScopesEntry.java +++ b/gen/main/java/issue/_315/ServiceScopesEntry.java @@ -20,7 +20,7 @@ public boolean equals(Object object) { @Override public int hashCode() { - return java.util.Objects.hash(); + return java.util.Objects.hash(super.hashCode()); } @Override diff --git a/gen/main/java/testmodel/micronaut_pojo/InheritanceWithEnumType3.java b/gen/main/java/testmodel/micronaut_pojo/InheritanceWithEnumType3.java index e591c662..24bee1c9 100644 --- a/gen/main/java/testmodel/micronaut_pojo/InheritanceWithEnumType3.java +++ b/gen/main/java/testmodel/micronaut_pojo/InheritanceWithEnumType3.java @@ -25,7 +25,7 @@ public boolean equals(Object object) { @Override public int hashCode() { - return java.util.Objects.hash(); + return java.util.Objects.hash(super.hashCode()); } @Override diff --git a/gen/main/java/testmodel/micronaut_pojo_nullable/InheritanceWithEnumType3.java b/gen/main/java/testmodel/micronaut_pojo_nullable/InheritanceWithEnumType3.java index 9b2b1855..fdb97bc3 100644 --- a/gen/main/java/testmodel/micronaut_pojo_nullable/InheritanceWithEnumType3.java +++ b/gen/main/java/testmodel/micronaut_pojo_nullable/InheritanceWithEnumType3.java @@ -25,7 +25,7 @@ public boolean equals(Object object) { @Override public int hashCode() { - return java.util.Objects.hash(); + return java.util.Objects.hash(super.hashCode()); } @Override diff --git a/gen/main/java/testmodel/nomicronaut/InheritanceWithEnumType3.java b/gen/main/java/testmodel/nomicronaut/InheritanceWithEnumType3.java index 52411be2..4d0cc36c 100644 --- a/gen/main/java/testmodel/nomicronaut/InheritanceWithEnumType3.java +++ b/gen/main/java/testmodel/nomicronaut/InheritanceWithEnumType3.java @@ -23,7 +23,7 @@ public boolean equals(Object object) { @Override public int hashCode() { - return java.util.Objects.hash(); + return java.util.Objects.hash(super.hashCode()); } @Override diff --git a/src/main/resources/Micronaut/modelPojo.mustache b/src/main/resources/Micronaut/modelPojo.mustache index 327b6e5c..5f5f0b41 100644 --- a/src/main/resources/Micronaut/modelPojo.mustache +++ b/src/main/resources/Micronaut/modelPojo.mustache @@ -50,7 +50,7 @@ public {{#discriminator}}abstract {{/discriminator}}class {{classname}}{{^parent @Override public int hashCode() { - return java.util.Objects.hash({{#vendorExtensions.additionalPropertiesMap}}this.additionalProperties{{#vars}}, {{/vars}}{{/vendorExtensions.additionalPropertiesMap}}{{^vars}}{{#discriminator}}{{discriminator.propertyGetter}}(){{/discriminator}}{{/vars}}{{#vars}}{{^isFile}}{{^isByteArray}}{{name}}{{/isByteArray}}{{/isFile}}{{#isByteArray}}java.util.Arrays.hashCode({{name}}){{/isByteArray}}{{#isFile}}java.util.Arrays.hashCode({{name}}){{/isFile}}{{^-last}}, {{/-last}}{{#-last}}{{#discriminator}}, {{discriminator.propertyGetter}}(){{/discriminator}}{{#parent}}, super.hashCode(){{/parent}}{{/-last}}{{/vars}}); + return java.util.Objects.hash({{#vendorExtensions.additionalPropertiesMap}}this.additionalProperties{{#vars}}, {{/vars}}{{/vendorExtensions.additionalPropertiesMap}}{{^vars}}{{#discriminator}}{{discriminator.propertyGetter}}(){{/discriminator}}{{/vars}}{{#vars}}{{^isFile}}{{^isByteArray}}{{name}}{{/isByteArray}}{{/isFile}}{{#isByteArray}}java.util.Arrays.hashCode({{name}}){{/isByteArray}}{{#isFile}}java.util.Arrays.hashCode({{name}}){{/isFile}}{{^-last}}, {{/-last}}{{#-last}}{{#discriminator}}, {{discriminator.propertyGetter}}(){{/discriminator}}{{/-last}}{{/vars}}{{#parent}}{{#vars}}, {{/vars}}super.hashCode(){{/parent}}); } @Override