Update kotlinPoet to v2 (major) #194
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
1.13.1->2.2.01.13.1->2.2.0Release Notes
square/kotlinpoet (com.squareup:kotlinpoet-ksp)
v2.2.0Compare Source
Thanks to @IRus for contributing to this release.
v2.1.0Compare Source
Thanks to @ForteScarlet, @TrevorSStone, @RaoPrashanth, @damianw, @ansehoon1999, @TheMrMilchmann for contributing to this release.
TypeName.MUTABLE_MAP_ENTRYnow correctly uses theMutableEntrynested class name. (#2061)v2.0.0Compare Source
Thanks to @brokenhappy, @tajobe, @niyajali, @ForteScarlet for contributing to this release.
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.♢placeholder representing a space that is safe to wrap.KSTypeAlias.toClassName(). (#1956)KSType.toClassNameOrNull(). (#1956)KSAnnotation.toAnnotationSpec(). (#1956)KSType.toClassName(). (#1956)v1.18.1Compare Source
Thanks to @mitasov-ra for contributing to this release.
v1.18.0Compare Source
Thanks to @DanielGronau for contributing to this release.
kotlinpoet-metadataout of preview to stable.kotlinpoet-metadatato stableorg.jetbrains.kotlin:kotlin-metadata-jvmartifact for Metadata parsing.KSAnnotation.toAnnotationSpec()andKSClassDeclaration.toClassName()more robust.LambdaTypeNames inKSTypeReference.toTypeName().%Ltranslation (#1927).v1.17.0Compare Source
Thanks to @jisungbin, @hfhbd, @evant, @sgjesse, @sebek64 for contributing to this release.
KotlinClassMetadata.readis deprecated in 0.9.0 and replaced withreadStrict(#1830).lenientparameters to map to the underlyingreadStrict()andreadLenient()calls (#1766).Class/TypeElement/Metadata-to-KmClassAPIs from the public API, as these are trivial to write now with kotlinx-metadata's newer APIs and allows us to focus the API surface area of this artifact better (#1891).MemberSpecHolderinterface for constructs that can holdPropertySpecs andFunSpecs and their builders (#1877).joinToCodevariant which operates on any type, but requires a transform lambda to convert each element into aCodeBlock(#1874).KSAnnotation.toAnnotationSpec()(#1889).FileSpec.scriptBuilder(#1813).PropertySpec(#1827).KSAnnotation.toAnnotationSpecwrites varargs in place instead of making them an array to work around a Kotlin issue with OptIn annotations (#1833).MemberNames without a package are now correctly imported (#1841)KSType.toClassName()(#1890).MemberNames (#1909).v1.16.0Compare Source
Thanks to @drawers, @rickclephas for contributing to this release.
NameAllocatorAPI to control keyword pre-allocation (#1803).KSTypeReference.toTypeName(#1793).v1.15.3Compare Source
Thanks to @gabrielittner for contributing to this release.
KSTypeReference.toTypeName(#1756).v1.15.2Compare Source
Thanks to @evant for contributing to this release.
v1.15.1Compare Source
v1.15.0Compare Source
Thanks to @drawers, @fejesjoco, @takahirom, @martinbonnin, @mcarleio for contributing to this release.
In this release the
:kotlinpoetmodule has been converted to a Kotlin Multiplatform module (#1654), though for now it only supports the JVM target.TypeSpecHolderinterface for constructs that can hold aTypeSpecand their builders (#1723).FileSpec(#1720).FileSpec.writeTo(). (#1514).TypeSpec.expectClassBuilder()andTypeSpec.valueClassBuilder()(#1589).KSAnnotationtoAnnotationSpecwhile omitting default values (#1538).FileSpec.builderconvenience forMemberName(#1585).DecimalFormatSymbols.minusSignfor consistency across locales (#1658).:kotlinpoet-metadatamodule, as mostFlags-API extensions have been removed in favor of the now-available first-party versions.v1.14.2Compare Source
Annotatable.Builder(#1581).v1.14.1Compare Source
v1.14.0Compare Source
Thanks to @Omico, @drawers, @RBusarow for contributing to this release.
New: Kotlin 1.8.21.
New: KSP 1.8.21-1.0.11.
New: Enable default methods in Java bytecode (#1561).
New: Group Kotlin and Renovate updates together in Renovate (#1562).
New: Extract trait interface for annotatable constructs and their builders (#1564).
New: Extract trait interface for documentable constructs and their builders (#1571).
New: Document the usage of
STAR(#1572).New: Add builder for
FunSpecwhich accepts aMemberName(#1574).Fix: Omit public modifier on override function or constructor parameters (#1550).
Fix: Correct handling of members in various types (#1558).
Fix: Function return types now default to
Unitunless explicitly set (#1559).Previously the default was
nullwhich behaved likeUnitfor block bodies. When an expression body was produced,however, no return type would be emitted. This meant that the return type was implicit based on the contents of
the body.
With this change, when no return type is specified and an expression body is produced, the return type will be
explicitly
Unit. Specify the actual return type explicitly to correct the output.Old versions:
This version, incorrect:
This version, correct:
val funSpec = FunSpec.builder("foo") + .returns(INT) .addStatement("return 1") .build()Additionally, as part of this change,
FunSpec.returnTypehas changed to be non-nullable. This is a source- andbinary-compatible change, although if you were performing null-checks then new warnings may appear after upgrade.
Fix: Append nested class names to alias during name lookup (#1568).
Fix: Allow PropertySpec with context receivers and without getter or setter (#1575).
v1.13.2Compare Source
What's Changed
New Contributors
Full Changelog: square/kotlinpoet@1.13.1...1.13.2
Configuration
📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.