2019-11-16
2019-10-30
2019-10-28
2019-10-18
TypeAliasSpec
.Metadata
.ImmutableKmDeclarationContainer
.auto-common
.Asset<A : Asset<A>>
) from Kotlin Metadata
.2019-09-24
New: This release introduces the new KotlinPoet-metadata API that makes it easy to introspect Kotlin types and build KotlinPoet Specs based on that data.
The strategy for type introspection is driven by ClassInspector
, which is a basic interface for looking up JVM information about a given Class. This optionally is used by the toTypeSpec()
/toFileSpec()
APIs in kotlinpoet-metadata-specs
artifact to inform about Classes with information that isn’t present in metadata (overrides, JVM modifiers, etc). There are two batteries-included implementations available in ReflectiveClassInspector
(for reflection) and ElementsClassInspector
(for the javax Elements API in annotation processing). These implementations are available through their respective kotlinpoet-classinspector-*
artifacts. For more information refer to the KotlinPoet-metadata-specs README.
At the time of this release the API is in experimental mode and has to be opted into via the KotlinPoetMetadataPreview
annotation.
New: Kotlin 1.3.50.
New: A new constructor to simplify creation of ParameterSpec
instances.
New: New ClassName
constructors.
New: TypeName
and subclasses can now store tags.
New: Optional parameters added to toBuilder()
methods of most Specs.
New: List
overrides for Spec methods that accept vararg
s.
New: CodeBlock.Builder.clear()
helper method.
New: FunSpec.Builder.clearBody()
helper method.
Fix: Properly escape enum constant names.
Fix: Ensure trailing newlines in KDoc and function bodies.
Fix: TypeVariableName
s with empty bounds will now default to Any?
.
Fix: Don't emit parens for primary constructors.
Fix: ClassName
s with empty simple names are not allowed anymore.
Fix: Throw if names contain illegal characters that can't be escaped with backticks.
2019-05-30
2019-03-28
2019-02-28
%M
and MemberName
type.MemberName
from a ClassName
, KClass
and Class
.CodeBlock
s as arguments to %P
.toString()
.LineWrapper
to enable proper line wrapping in KDoc.TypeSpec
Kdoc with no tags.FunSpec
.CodeWriter.resolve()
by precomputing all of the nested simple names of a TypeSpec
.KType.asTypeName()
.FileSpec
.2019-01-02
2018-12-10
2018-11-28
%P
placeholder for string templates.Unit
as return type.%>
, %<
, %[
, %]
placeholders with ⇥
, ⇤
, «
, »
.%W
with space, and add ·
as a non-breaking space.TypeName
to sealed class.TypeName
modifier methods with copy()
.WildcardTypeName
to match with the producer/consumer generics model.TypeName.nullable
into TypeName.isNullable
.LambdaTypeName.suspending
into LambdaTypeName.isSuspending
.TypeVariableName.reified
into TypeVariableName.isReified
.Any?
upper bound.2018-10-22
beginControlFlow()
.ParameterSpec
, collapse into parent KDoc.TypeVariable
s in PropertySpec
.LambdaTypeName
.buildCodeBlock()
helper function.CodeBlock
s with statements as property initializers and default parameter values.NameAllocator.clone()
into `NameAllocator.copy().TypeName.asNonNullable()
to TypeName.asNonNull()
.PropertySpec.varBuilder()
(use mutable()
instead).IntArray
and Array<Int>
when creating TypeName
.TypeName
instead of ClassName
as parameter type of plusParameter()
.TypeName
from KType
.FileSpec.Builder
blank package and subfolder fix.toBuilder()
.2018-07-16
external
support.KType
and KTypeParameter
.TypeSpec#toBuilder()
.ParameterizedTypeName
API.WildcardTypeName.STAR
constant.Any?
as the default type variable bounds.TypeName
.TypeVariable
bound when more bounds are added.2018-02-16
PropertySpec
s as CodeBlock
literals.TypeAliasSpec
.ParameterSpec
which is also a keyword.LambdaTypeName
parameters.Any?
.2017-11-03
import bar.Bar as bBar
.LambdaTypeName
.2017-09-13
addFun()
to addFunction()
.KotlinFile
to FileSpec
.KotlinFile.addFileAnnotation()
to addAnnotation()
.KotlinFile.addFileComment()
to addComment()
.HEADER
and IMPL
modifiers.2017-08-08
asClassName()
to be top-level functions.constructor
keyword.NameAllocator
.AnnotationSpec
for throws.2017-06-11
TypeAliasSpec
to create type aliases.LambdaTypeName
to create lambda types.Runnable::class.asClassName()
.Filer
writing and originating elements concept. These stem from javac
annotation processors.KModifier
for varargs.ParameterizedTypeName
for array types.KClass
instead of Java name.Double::class
instead of Double.class
.2017-05-21
:
instead of extends
and implements
.init {}
.2017-05-16