diff --git a/docs/changelog.md b/docs/changelog.md index c87f44c5c7..5dbd4a4d0c 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,11 +3,36 @@ Change Log ## Unreleased -* Fix: Enum classes that only have an init block now also generate the required semicolon (#1952) -* Fix: Preserve typealiases in `KSAnnotation.toAnnotationSpec()`. (#1945) -* Fix: Preserve nullability in `KSType.toClassName()`. (#1956) -* New: Add `KSTypeAlias.toClassName()`. (#1956) -* New: Add `KSType.toClassNameOrNull()`. (#1956) +## Version 2.0.0 + +Thanks to [@brokenhappy][brokenhappy], [@tajobe][tajobe], [@niyajali][niyajali], +[@ForteScarlet][ForteScarlet] for contributing to this release. + +_2024-10-23_ + +This release is source- and binary-compatible with KotlinPoet 1.x. + +The most important behavior change in this release is that spaces in generated code don't wrap by +default anymore. + +KotlinPoet 1.x used to replace space characters with newline characters whenever a given line of +code exceeded the length limit. This usually led to better code formatting, but could also lead to +compilation errors in generated code. Non-breaking spaces could be marked by the `·` character, but +the discoverability of this feature wasn't great. + +KotlinPoet 2.0 does not wrap spaces, even if the line of code they occur in exceeds the length +limit. The newly introduced `♢` character can be used to mark spaces that are safe to wrap, which +can improve code formatting. The `·` character has been preserved for compatibility, but its +behavior is now equivalent to a regular space character. + + * New: Kotlin 2.0.10. + * New: Spaces don't break by default. + * New: New `♢` placeholder representing a space that is safe to wrap. + * New: Add `KSTypeAlias.toClassName()`. (#1956) + * New: Add `KSType.toClassNameOrNull()`. (#1956) + * Fix: Enum classes that only have an init block now also generate the required semicolon. (#1953) + * Fix: Preserve typealiases in `KSAnnotation.toAnnotationSpec()`. (#1956) + * Fix: Preserve nullability in `KSType.toClassName()`. (#1956) ## Version 1.18.1 @@ -863,3 +888,7 @@ _2017-05-16_ [sebek64]: https://github.com/sebek64 [DanielGronau]: https://github.com/DanielGronau [mitasov-ra]: https://github.com/mitasov-ra + [brokenhappy]: https://github.com/brokenhappy + [tajobe]: https://github.com/tajobe + [niyajali]: https://github.com/niyajali + [ForteScarlet]: https://github.com/ForteScarlet diff --git a/gradle.properties b/gradle.properties index d7e74c9b6a..b74cab0d8a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8' GROUP=com.squareup -VERSION_NAME=1.19.0-SNAPSHOT +VERSION_NAME=2.0.0 POM_URL=https://github.com/square/kotlinpoet POM_SCM_URL=https://github.com/square/kotlinpoet