Skip to content

Releases: square/kotlinpoet

1.16.0

18 Jan 23:23
Compare
Choose a tag to compare

Thanks to @drawers, @rickclephas for contributing to this release.

  • New: Kotlin 1.9.22.
  • New: KSP 1.9.22-1.0.16.
  • New: Add NameAllocator API to control keyword pre-allocation (#1803).
  • Fix: Fix issue with missing suspend modifier in KSTypeReference.toTypeName (#1793).
  • Fix: Honour same-package import aliases (#1794).
  • Fix: Always include parameter docs in the type header (#1800).

1.15.3

04 Dec 12:57
Compare
Choose a tag to compare

Thanks to @gabrielittner for contributing to this release.

  • Fix: Fix nullability of lambdas in KSTypeReference.toTypeName (#1756).

1.15.2

30 Nov 16:34
Compare
Choose a tag to compare

Thanks to @evant for contributing to this release.

  • New: Kotlin 1.9.21.
  • New: KSP 1.9.21-1.0.15.
  • New: KSP: more accurately represent function types (#1742).

1.15.1

19 Nov 12:18
Compare
Choose a tag to compare
  • Fix: Fix a regression introduced by #1637, where a superfluous newline is added to a type's KDoc if it has a primary constructor with no docs (#1727).

1.15.0

18 Nov 10:16
Compare
Choose a tag to compare

Thanks to @drawers, @fejesjoco, @takahirom, @martinbonnin, @mcarleio for contributing to this release.

In this release the :kotlinpoet module has been converted to a Kotlin Multiplatform module (#1654), though for now it only supports the JVM target.

  • New: Kotlin 1.9.20.
  • New: KSP 1.9.20-1.0.14.
  • New: Extract TypeSpecHolder interface for constructs that can hold a TypeSpec and their builders (#1723).
  • New: Expose relative path from FileSpec (#1720).
  • New: Return the generated path from FileSpec.writeTo(). (#1514).
  • New: Remove default compatibility from unstable types (#1662).
  • New: Deprecate TypeSpec.expectClassBuilder() and TypeSpec.valueClassBuilder() (#1589).
  • New: Add option to convert KSAnnotation to AnnotationSpec while omitting default values (#1538).
  • New: Add FileSpec.builder convenience for MemberName (#1585).
  • Fix: Set DecimalFormatSymbols.minusSign for consistency across locales (#1658).
  • Fix: Fix link to incremental KSP in KDoc (#1638).
  • Fix: Emit primary constructor KDoc (#1637).
  • Change: kotlinx-metadata 0.7.0. This is a breaking change for users of the :kotlinpoet-metadata module, as most Flags-API extensions have been removed in favor of the now-available first-party versions.

1.14.2

30 May 09:35
Compare
Choose a tag to compare
  • Fix: Fix one more missing API in binary compatibility override in Annotatable.Builder (#1581).

1.14.1

29 May 15:33
Compare
Choose a tag to compare
  • Fix: Restore ABI stability for annotatable and documentable builders (#1580).

1.14.0

29 May 10:42
Compare
Choose a tag to compare

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 FunSpec which accepts a MemberName (#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 Unit unless explicitly set (#1559).

    Previously the default was null which behaved like Unit for 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:

    val funSpec = FunSpec.builder("foo")
      .addStatement("return 1")
      .build()
    public fun foo() = 1

    This version, incorrect:

    val funSpec = FunSpec.builder("foo")
      .addStatement("return 1")
      .build()
    public fun foo(): Unit = 1 // ❌

    This version, correct:

     val funSpec = FunSpec.builder("foo")
    +  .returns(INT)
       .addStatement("return 1")
       .build()
    public fun foo(): Int = 1 // βœ…

    Additionally, as part of this change, FunSpec.returnType has changed to be non-nullable. This is a source- and
    binary-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).

1.13.2

05 May 09:13
Compare
Choose a tag to compare

What's Changed

  • KSType.toTypeName fixed to work with aliased types by @Squiry in #1534

New Contributors

Full Changelog: 1.13.1...1.13.2

1.13.1

28 Apr 11:30
Compare
Choose a tag to compare

What's Changed

  • Fix: Look at canonical names instead of just package names when generating import aliases by @Egorand in #1519
  • Fix: Ignore KSP annotation arguments without a value by @rickclephas in #1523
  • Fix: Fix arguments handling in KSType.toTypeName() by @ZacSweers in #1529

New Contributors

Full Changelog: 1.13.0...1.13.1