codegen-java/kotlin: Fix generation of hashCode methods (#802)

codegen-java:
- use `pattern.pattern()` instead of `pattern` in hashCode method
  (consistent with equals method)

codegen-kotlin:
- use `regex.pattern` instead of `regex` in hashCode method
  (consistent with equals method)
- if a data class has a Regex property, generate not only
  an equals method but also a hashCode method
This commit is contained in:
translatenix authored and GitHub committed 2024-11-13 15:42:45 -08:00
1 parent b8d90eddec
commit df38011c9e
5 files changed
+39 -16

No files matched your search

@@ -306,7 +306,7 @@ public final class Mod {
result = 31 * result + Objects.hashCode(this.container);
result = 31 * result + Objects.hashCode(this.container2);
result = 31 * result + Objects.hashCode(this.other);
result = 31 * result + Objects.hashCode(this.regex);
result = 31 * result + Objects.hashCode(this.regex.pattern());
result = 31 * result + Objects.hashCode(this.any);
result = 31 * result + Objects.hashCode(this.nonNull);
result = 31 * result + Objects.hashCode(this._enum);