[PR #714] [MERGED] codegen-kotlin: Don't generate equals/hashCode/toString/copy/:Serializable for abstract classes #688

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

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/714
Author: @odenix
Created: 10/20/2024
Status: Merged
Merged: 10/24/2024
Merged by: @bioball

Base: mainHead: codegen-abstract


📝 Commits (3)

  • 498a21a codegen-kotlin: Don't generate equals/hashCode/toString/copy/:Serializable for abstract classes
  • 0f85eb1 Polish KotlinCodeGeneratorTest
  • a7936f5 Overhaul KotlinCodeGeneratorTest

📊 Changes

2 files changed (+858 additions, -776 deletions)

View changed files

📝 pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt (+8 -7)
📝 pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt (+850 -769)

📄 Description

Motivation:
Don't generate code that isn't useful.

Changes:

  • Don't generate equals/hashCode/toString/copy methods for abstract classes.
  • Don't make abstract classes serializable.

Result:

  • Less code is generated.
  • Fixes #713.

Note:
codegen-java does the same for stateless classes, but it also makes them non-instantiable.
codegen-kotlin generates stateless regular classes far less often than codegen-java.


🔄 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/714 **Author:** [@odenix](https://github.com/odenix) **Created:** 10/20/2024 **Status:** ✅ Merged **Merged:** 10/24/2024 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `codegen-abstract` --- ### 📝 Commits (3) - [`498a21a`](https://github.com/apple/pkl/commit/498a21aab20eea12321642be4ac66b70257011e9) codegen-kotlin: Don't generate equals/hashCode/toString/copy/:Serializable for abstract classes - [`0f85eb1`](https://github.com/apple/pkl/commit/0f85eb1ac8aa6288ef369cccb31c2977f570b774) Polish KotlinCodeGeneratorTest - [`a7936f5`](https://github.com/apple/pkl/commit/a7936f5b640ae475486cd03dadbe14e646dc3112) Overhaul KotlinCodeGeneratorTest ### 📊 Changes **2 files changed** (+858 additions, -776 deletions) <details> <summary>View changed files</summary> 📝 `pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt` (+8 -7) 📝 `pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt` (+850 -769) </details> ### 📄 Description Motivation: Don't generate code that isn't useful. Changes: - Don't generate equals/hashCode/toString/copy methods for abstract classes. - Don't make abstract classes serializable. Result: - Less code is generated. - Fixes #713. Note: codegen-java does the same for stateless classes, but it also makes them non-instantiable. codegen-kotlin generates stateless regular classes far less often than codegen-java. --- <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:10 +01:00
adam closed this issue 2025-12-30 01:26:10 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#688