[PR #802] [MERGED] codegen-java/kotlin: Fix generation of hashCode methods #746

Closed
opened 2025-12-30 01:26:30 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/802
Author: @odenix
Created: 11/12/2024
Status: Merged
Merged: 11/14/2024
Merged by: @bioball

Base: mainHead: codegen-hashcode


📝 Commits (1)

  • f9ad550 codegen-java/kotlin: Fix generation of hashCode methods

📊 Changes

5 files changed (+39 additions, -16 deletions)

View changed files

📝 pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt (+7 -5)
📝 pkl-codegen-java/src/test/resources/org/pkl/codegen/java/PropertyTypes.jva (+1 -1)
📝 pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt (+10 -9)
📝 pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt (+20 -0)
📝 pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/PropertyTypes.kotlin (+1 -1)

📄 Description

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 issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/802 **Author:** [@odenix](https://github.com/odenix) **Created:** 11/12/2024 **Status:** ✅ Merged **Merged:** 11/14/2024 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `codegen-hashcode` --- ### 📝 Commits (1) - [`f9ad550`](https://github.com/apple/pkl/commit/f9ad550e64c446e1d7021bcd29a757404cf91aab) codegen-java/kotlin: Fix generation of hashCode methods ### 📊 Changes **5 files changed** (+39 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/JavaCodeGenerator.kt` (+7 -5) 📝 `pkl-codegen-java/src/test/resources/org/pkl/codegen/java/PropertyTypes.jva` (+1 -1) 📝 `pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt` (+10 -9) 📝 `pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt` (+20 -0) 📝 `pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/PropertyTypes.kotlin` (+1 -1) </details> ### 📄 Description 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:26:30 +01:00
adam closed this issue 2025-12-30 01:26:30 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#746