github square/kotlinpoet 1.11.0

latest releases: 1.18.1, 1.18.0, 1.17.0...
2 years ago

Thanks to @liujingxing and @BoD for contributing to this release.

  • New: Kotlin scripting support in FileSpec.

    val spec = FileSpec.scriptBuilder("Taco")
      .addStatement("println(%S)", "hello world!")
      .addKotlinDefaultImports()
      .build()

    Generates a Taco.kts file with the following contents:

    println("hello world!")
  • New: Emit trailing commas for multi-line parameters and annotations.

  • New: Add KSAnnotation.toAnnotationSpec().

  • New: Add Unit and CharSequence conversions in javapoet-interop.

  • New: Add support for default imports in FileSpec.

    • This is particularly oriented at scripting support, but can also be used in non-script files.
  • New: Update to Kotlin 1.6.10.

  • Fix: Fail compilation if you only pass one string to ClassName.

  • Fix: Inline val property if its getter is inline.

  • Fix: Add yield to the list of reserved keywords.

  • Fix: Enforce only allowed parameter modifiers in ParameterSpec (i.e. crossinline, vararg, and noinline).

  • Fix: Fix CodeBlocks in class delegation getting toString()'d instead of participating in code writing.

  • Fix: Error when attempting to convert KSP error types (i.e. if KSType.isError is true) to TypeName.

Don't miss a new kotlinpoet release

NewReleases is sending notifications on new releases.