Note to reviewers: The second commit is a rename refactoring.
codegen-kotlin: Generate toString() methods consistent with data classes
Motivation:
codegen-kotlin generates a mix of data classes and regular classes.
For regular classes, toString() methods are also generated.
However, the output of generated toString() methods
differs from the output of default toString() methods of data classes.
Changes:
Generate toString() methods that produce the same output
as default toString() methods of data classes.
Result:
Less and simpler code is generated.
Object graphs containing a mix of data classes and regular classes are formatted consistently.
🔄 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/793
**Author:** [@odenix](https://github.com/odenix)
**Created:** 11/8/2024
**Status:** ✅ Merged
**Merged:** 11/14/2024
**Merged by:** [@bioball](https://github.com/bioball)
**Base:** `main` ← **Head:** `kotlin-tostring`
---
### 📝 Commits (3)
- [`9cee7cc`](https://github.com/apple/pkl/commit/9cee7ccff88c957c9e05658a51bc8e8d718ebece) codegen-kotlin: Generate toString() methods consistent with data classes
- [`197c68e`](https://github.com/apple/pkl/commit/197c68ed1af4267e2a1fbd7db6fbd87e6e82ab6b) Rename KotlinCodegenOptions to KotlinCodeGeneratorOptions
- [`2a43194`](https://github.com/apple/pkl/commit/2a43194fc6bb4c96350226dde90aa6be4910feee) Incorporate review feedback
### 📊 Changes
**6 files changed** (+86 additions, -279 deletions)
<details>
<summary>View changed files</summary>
📝 `pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/CliKotlinCodeGeneratorOptions.kt` (+2 -2)
📝 `pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt` (+25 -91)
📝 `pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt` (+51 -64)
📝 `pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/Inheritance.kotlin` (+4 -45)
📝 `pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/Kdoc.kotlin` (+1 -23)
📝 `pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/PropertyTypes.kotlin` (+3 -54)
</details>
### 📄 Description
Note to reviewers: The second commit is a rename refactoring.
codegen-kotlin: Generate toString() methods consistent with data classes
Motivation:
codegen-kotlin generates a mix of data classes and regular classes.
For regular classes, toString() methods are also generated.
However, the output of generated toString() methods
differs from the output of default toString() methods of data classes.
Changes:
Generate toString() methods that produce the same output
as default toString() methods of data classes.
Result:
- Less and simpler code is generated.
- Object graphs containing a mix of data classes and regular classes are formatted consistently.
- Fixes #717.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/apple/pkl/pull/793
Author: @odenix
Created: 11/8/2024
Status: ✅ Merged
Merged: 11/14/2024
Merged by: @bioball
Base:
main← Head:kotlin-tostring📝 Commits (3)
9cee7cccodegen-kotlin: Generate toString() methods consistent with data classes197c68eRename KotlinCodegenOptions to KotlinCodeGeneratorOptions2a43194Incorporate review feedback📊 Changes
6 files changed (+86 additions, -279 deletions)
View changed files
📝
pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/CliKotlinCodeGeneratorOptions.kt(+2 -2)📝
pkl-codegen-kotlin/src/main/kotlin/org/pkl/codegen/kotlin/KotlinCodeGenerator.kt(+25 -91)📝
pkl-codegen-kotlin/src/test/kotlin/org/pkl/codegen/kotlin/KotlinCodeGeneratorTest.kt(+51 -64)📝
pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/Inheritance.kotlin(+4 -45)📝
pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/Kdoc.kotlin(+1 -23)📝
pkl-codegen-kotlin/src/test/resources/org/pkl/codegen/kotlin/PropertyTypes.kotlin(+3 -54)📄 Description
Note to reviewers: The second commit is a rename refactoring.
codegen-kotlin: Generate toString() methods consistent with data classes
Motivation:
codegen-kotlin generates a mix of data classes and regular classes.
For regular classes, toString() methods are also generated.
However, the output of generated toString() methods
differs from the output of default toString() methods of data classes.
Changes:
Generate toString() methods that produce the same output
as default toString() methods of data classes.
Result:
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.