Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce builder for exception type #52

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion kotlin-code-generation/src/main/kotlin/KotlinCodeGeneration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.interfaceBu
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.objectBuilder
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.parameterBuilder
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.propertyBuilder
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.runtimeExceptionClassBuilder
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.typeAliasBuilder
import io.toolisticon.kotlin.generation.KotlinCodeGeneration.builder.valueClassBuilder
import io.toolisticon.kotlin.generation.builder.*
import io.toolisticon.kotlin.generation.builder.extra.RuntimeExceptionSpecBuilder
import io.toolisticon.kotlin.generation.builder.extra.RuntimeExceptionSpecBuilderReceiver
import io.toolisticon.kotlin.generation.poet.FormatSpecifier.asCodeBlock
import io.toolisticon.kotlin.generation.spec.*
import io.toolisticon.kotlin.generation.spi.KotlinCodeGenerationContext
Expand Down Expand Up @@ -80,6 +83,16 @@ object KotlinCodeGeneration : KLogging() {
*/
inline fun buildClass(packageName: PackageName, simpleName: SimpleName, block: KotlinClassSpecBuilderReceiver = {}) = buildClass(className(packageName, simpleName), block)

/**
* @see RuntimeExceptionSpecBuilder
*/
inline fun buildRuntimeExceptionClass(packageName: PackageName, simpleName: SimpleName, block: RuntimeExceptionSpecBuilderReceiver = {}) = buildRuntimeExceptionClass(className(packageName, simpleName), block)

/**
* @see RuntimeExceptionSpecBuilder
*/
inline fun buildRuntimeExceptionClass(className: ClassName, block: RuntimeExceptionSpecBuilderReceiver = {}) = runtimeExceptionClassBuilder(className).also(block).build()

/**
* @see [CodeBlock.of]
*/
Expand Down Expand Up @@ -137,7 +150,7 @@ object KotlinCodeGeneration : KLogging() {
* Build [KotlinFileSpec].
* @see [KotlinFileSpecBuilder.builder]
*/
inline fun buildFile(className: ClassName, block: KotlinFileSpecBuilderReceiver = {}): KotlinFileSpec = fileBuilder(className).also(block).build()
inline fun buildFile(className: ClassName, block: KotlinFileSpecBuilderReceiver = {}) = fileBuilder(className).also(block).build()

/**
* Build [KotlinFileSpec].
Expand Down Expand Up @@ -305,6 +318,11 @@ object KotlinCodeGeneration : KLogging() {
*/
fun enumClassBuilder(className: ClassName) = KotlinEnumClassSpecBuilder.builder(className)

/**
* @see KotlinExceptionClassSpecBuilder
*/
fun runtimeExceptionClassBuilder(className: ClassName) = RuntimeExceptionSpecBuilder.builder(className)

/**
* @see KotlinFileSpecBuilder
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.toolisticon.kotlin.generation.poet.*
import io.toolisticon.kotlin.generation.spec.*
import javax.lang.model.element.Element
import kotlin.reflect.KClass

/**
* Builder for [KotlinAnnotationClassSpec].
Expand All @@ -19,12 +20,10 @@
val className: ClassName,
private val delegate: TypeSpecBuilder
) : KotlinGeneratorTypeSpecBuilder<KotlinAnnotationClassSpecBuilder, KotlinAnnotationClassSpec>,
KotlinAnnotatableBuilder<KotlinAnnotationClassSpecBuilder>,
KotlinAnnotatableDocumentableModifiableBuilder<KotlinAnnotationClassSpecBuilder>,
KotlinConstructorPropertySupport<KotlinAnnotationClassSpecBuilder>,
KotlinContextReceivableBuilder<KotlinAnnotationClassSpecBuilder>,
KotlinDocumentableBuilder<KotlinAnnotationClassSpecBuilder>,
KotlinMemberSpecHolderBuilder<KotlinAnnotationClassSpecBuilder>,
KotlinModifiableBuilder<KotlinAnnotationClassSpecBuilder>,
KotlinTypeSpecHolderBuilder<KotlinAnnotationClassSpecBuilder> {

companion object {
Expand All @@ -51,14 +50,15 @@
this._retention = retention
}

override fun addAnnotation(spec: KotlinAnnotationSpecSupplier): KotlinAnnotationClassSpecBuilder = apply { delegate.addAnnotation(spec.get()) }
override fun addAnnotation(spec: KotlinAnnotationSpecSupplier) = apply { delegate.addAnnotation(spec.get()) }

Check warning on line 53 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt#L53

Added line #L53 was not covered by tests
override fun addConstructorProperty(spec: KotlinConstructorPropertySpecSupplier) = apply { constructorProperties[spec.name] = spec }
override fun contextReceivers(vararg receiverTypes: TypeName): KotlinAnnotationClassSpecBuilder = builder { this.contextReceivers(*receiverTypes) }
override fun addFunction(funSpec: KotlinFunSpecSupplier): KotlinAnnotationClassSpecBuilder = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc): KotlinAnnotationClassSpecBuilder = apply { delegate.addKdoc(kdoc.get()) }
override fun contextReceivers(vararg receiverTypes: TypeName) = builder { this.contextReceivers(*receiverTypes) }
override fun addFunction(funSpec: KotlinFunSpecSupplier) = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc) = apply { delegate.addKdoc(kdoc.get()) }

Check warning on line 57 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt#L55-L57

Added lines #L55 - L57 were not covered by tests
override fun addModifiers(vararg modifiers: KModifier) = builder { this.addModifiers(*modifiers) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier): KotlinAnnotationClassSpecBuilder = apply { delegate.addProperty(propertySpec.get()) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier) = apply { delegate.addProperty(propertySpec.get()) }

Check warning on line 59 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt#L59

Added line #L59 was not covered by tests
override fun addType(typeSpec: TypeSpecSupplier) = builder { this.addType(typeSpec.get()) }
override fun tag(type: KClass<*>, tag: Any?) = builder { this.tag(type, tag) }

Check warning on line 61 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationClassSpecBuilder.kt#L61

Added line #L61 was not covered by tests

fun addOriginatingElement(originatingElement: Element) = builder { this.addOriginatingElement(originatingElement) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
class KotlinAnnotationSpecBuilder internal constructor(
private val delegate: AnnotationSpecBuilder
) : BuilderSupplier<KotlinAnnotationSpec, AnnotationSpec>,
KotlinTaggableBuilder<KotlinAnnotationSpecBuilder>,
KotlinAnnotationSpecSupplier,
DelegatingBuilder<KotlinAnnotationSpecBuilder, AnnotationSpecBuilderReceiver> {

Expand Down Expand Up @@ -68,6 +69,8 @@
private var multiLine = false
private val members: MutableList<CodeBlock> = mutableListOf()

override fun tag(type: KClass<*>, tag: Any?) = builder { this.tag(type, tag) }

Check warning on line 72 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnnotationSpecBuilder.kt#L72

Added line #L72 was not covered by tests

fun multiLine() = apply { multiLine = true }

fun addMember(codeBlock: CodeBlock): KotlinAnnotationSpecBuilder = apply { members.add(codeBlock) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
class KotlinAnonymousClassSpecBuilder internal constructor(
private val delegate: TypeSpecBuilder
) : KotlinGeneratorTypeSpecBuilder<KotlinAnonymousClassSpecBuilder, KotlinAnonymousClassSpec>,
KotlinAnnotatableBuilder<KotlinAnonymousClassSpecBuilder>,
KotlinAnnotatableDocumentableModifiableBuilder<KotlinAnonymousClassSpecBuilder>,
KotlinContextReceivableBuilder<KotlinAnonymousClassSpecBuilder>,
KotlinDocumentableBuilder<KotlinAnonymousClassSpecBuilder>,
KotlinMemberSpecHolderBuilder<KotlinAnonymousClassSpecBuilder>,
KotlinModifiableBuilder<KotlinAnonymousClassSpecBuilder>,
KotlinSuperInterfaceSupport<KotlinAnonymousClassSpecBuilder>,
KotlinTypeSpecHolderBuilder<KotlinAnonymousClassSpecBuilder>,
DelegatingBuilder<KotlinAnonymousClassSpecBuilder, TypeSpecBuilderReceiver> {
Expand All @@ -34,13 +32,14 @@

internal constructor() : this(delegate = TypeSpecBuilder.anonymousClassBuilder())

override fun addAnnotation(spec: KotlinAnnotationSpecSupplier): KotlinAnonymousClassSpecBuilder = apply { delegate.addAnnotation(spec.get()) }
override fun contextReceivers(vararg receiverTypes: TypeName): KotlinAnonymousClassSpecBuilder = builder { this.contextReceivers(*receiverTypes) }
override fun addFunction(funSpec: KotlinFunSpecSupplier): KotlinAnonymousClassSpecBuilder = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc): KotlinAnonymousClassSpecBuilder = apply { delegate.addKdoc(kdoc.get()) }
override fun addAnnotation(spec: KotlinAnnotationSpecSupplier) = apply { delegate.addAnnotation(spec.get()) }
override fun contextReceivers(vararg receiverTypes: TypeName) = builder { this.contextReceivers(*receiverTypes) }

Check warning on line 36 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt#L35-L36

Added lines #L35 - L36 were not covered by tests
override fun addFunction(funSpec: KotlinFunSpecSupplier) = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc) = apply { delegate.addKdoc(kdoc.get()) }

Check warning on line 38 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt#L38

Added line #L38 was not covered by tests
override fun addModifiers(vararg modifiers: KModifier) = builder { this.addModifiers(*modifiers) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier): KotlinAnonymousClassSpecBuilder = apply { delegate.addProperty(propertySpec.get()) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier) = apply { delegate.addProperty(propertySpec.get()) }

Check warning on line 40 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt#L40

Added line #L40 was not covered by tests
override fun addType(typeSpec: TypeSpecSupplier) = builder { this.addType(typeSpec.get()) }
override fun tag(type: KClass<*>, tag: Any?) = builder { this.tag(type, tag) }

Check warning on line 42 in kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinAnonymousClassSpecBuilder.kt#L42

Added line #L42 was not covered by tests

fun addOriginatingElement(originatingElement: Element) = builder { this.addOriginatingElement(originatingElement) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
*/
@ExperimentalKotlinPoetApi
class KotlinClassSpecBuilder internal constructor(
private val className: ClassName,
internal val className: ClassName,
private val delegate: TypeSpecBuilder
) : KotlinGeneratorTypeSpecBuilder<KotlinClassSpecBuilder, KotlinClassSpec>,
KotlinAnnotatableBuilder<KotlinClassSpecBuilder>,
KotlinAnnotatableDocumentableModifiableBuilder<KotlinClassSpecBuilder>,
KotlinConstructorPropertySupport<KotlinClassSpecBuilder>,
KotlinContextReceivableBuilder<KotlinClassSpecBuilder>,
KotlinDocumentableBuilder<KotlinClassSpecBuilder>,
KotlinMemberSpecHolderBuilder<KotlinClassSpecBuilder>,
KotlinModifiableBuilder<KotlinClassSpecBuilder>,
KotlinSuperInterfaceSupport<KotlinClassSpecBuilder>,
KotlinTypeSpecHolderBuilder<KotlinClassSpecBuilder> {

Expand All @@ -38,17 +36,20 @@
private val constructorProperties: LinkedHashMap<String, KotlinConstructorPropertySpecSupplier> = LinkedHashMap()
private var isSetPrimaryConstructor: Boolean = false

override fun addAnnotation(spec: KotlinAnnotationSpecSupplier): KotlinClassSpecBuilder = apply { delegate.addAnnotation(spec.get()) }
override fun addAnnotation(spec: KotlinAnnotationSpecSupplier) = apply { delegate.addAnnotation(spec.get()) }
override fun addConstructorProperty(spec: KotlinConstructorPropertySpecSupplier) = apply { constructorProperties[spec.name] = spec }
override fun contextReceivers(vararg receiverTypes: TypeName): KotlinClassSpecBuilder = builder { this.contextReceivers(*receiverTypes) }
override fun addFunction(funSpec: KotlinFunSpecSupplier): KotlinClassSpecBuilder = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc): KotlinClassSpecBuilder = apply { delegate.addKdoc(kdoc.get()) }
override fun contextReceivers(vararg receiverTypes: TypeName) = builder { this.contextReceivers(*receiverTypes) }

Check warning on line 41 in kotlin-code-generation/src/main/kotlin/builder/KotlinClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinClassSpecBuilder.kt#L41

Added line #L41 was not covered by tests
override fun addFunction(funSpec: KotlinFunSpecSupplier) = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc) = apply { delegate.addKdoc(kdoc.get()) }
override fun addModifiers(vararg modifiers: KModifier) = builder { this.addModifiers(*modifiers) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier): KotlinClassSpecBuilder = apply { delegate.addProperty(propertySpec.get()) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier) = apply { delegate.addProperty(propertySpec.get()) }
override fun addSuperinterface(superinterface: TypeName, constructorParameter: String) = builder { this.addSuperinterface(superinterface, constructorParameter) }
override fun addSuperinterface(superinterface: TypeName, delegate: CodeBlock) = builder { this.addSuperinterface(superinterface, delegate) }

Check warning on line 47 in kotlin-code-generation/src/main/kotlin/builder/KotlinClassSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinClassSpecBuilder.kt#L45-L47

Added lines #L45 - L47 were not covered by tests
override fun addType(typeSpec: TypeSpecSupplier) = builder { this.addType(typeSpec.get()) }

override fun tag(type: KClass<*>, tag: Any?) = builder { this.tag(type, tag) }
fun addOriginatingElement(originatingElement: Element) = builder { this.addOriginatingElement(originatingElement) }
fun addTypeVariable(typeVariable: TypeVariableName) = builder { this.addTypeVariable(typeVariable) }

fun primaryConstructor(primaryConstructor: FunSpecSupplier?) = apply {
if (primaryConstructor != null) {
delegate.primaryConstructor(primaryConstructor.get())
Expand All @@ -62,8 +63,6 @@
fun addSuperclassConstructorParameter(format: String, vararg args: Any) = builder { this.addSuperclassConstructorParameter(format, *args) }
fun addSuperclassConstructorParameter(codeBlock: CodeBlock) = builder { this.addSuperclassConstructorParameter(codeBlock) }

override fun addSuperinterface(superinterface: TypeName, constructorParameter: String) = builder { this.addSuperinterface(superinterface, constructorParameter) }
override fun addSuperinterface(superinterface: TypeName, delegate: CodeBlock) = builder { this.addSuperinterface(superinterface, delegate) }

fun addInitializerBlock(block: CodeBlock) = builder { this.addInitializerBlock(block) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
class KotlinCompanionObjectSpecBuilder internal constructor(
private val delegate: TypeSpecBuilder
) : KotlinGeneratorTypeSpecBuilder<KotlinCompanionObjectSpecBuilder, KotlinCompanionObjectSpec>,
KotlinAnnotatableBuilder<KotlinCompanionObjectSpecBuilder>,
KotlinAnnotatableDocumentableModifiableBuilder<KotlinCompanionObjectSpecBuilder>,
KotlinContextReceivableBuilder<KotlinCompanionObjectSpecBuilder>,
KotlinDocumentableBuilder<KotlinCompanionObjectSpecBuilder>,
KotlinMemberSpecHolderBuilder<KotlinCompanionObjectSpecBuilder>,
KotlinModifiableBuilder<KotlinCompanionObjectSpecBuilder>,
KotlinSuperInterfaceSupport<KotlinCompanionObjectSpecBuilder>,
KotlinTypeSpecHolderBuilder<KotlinCompanionObjectSpecBuilder> {

Expand All @@ -35,13 +33,14 @@

internal constructor(name: String? = null) : this(TypeSpecBuilder.Companion.companionObjectBuilder(name))

override fun addAnnotation(spec: KotlinAnnotationSpecSupplier): KotlinCompanionObjectSpecBuilder = apply { delegate.addAnnotation(spec.get()) }
override fun contextReceivers(vararg receiverTypes: TypeName): KotlinCompanionObjectSpecBuilder = builder { delegate.contextReceivers(*receiverTypes) }
override fun addFunction(funSpec: KotlinFunSpecSupplier): KotlinCompanionObjectSpecBuilder = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc): KotlinCompanionObjectSpecBuilder = apply { delegate.addKdoc(kdoc.get()) }
override fun addAnnotation(spec: KotlinAnnotationSpecSupplier) = apply { delegate.addAnnotation(spec.get()) }
override fun contextReceivers(vararg receiverTypes: TypeName) = builder { delegate.contextReceivers(*receiverTypes) }
override fun addFunction(funSpec: KotlinFunSpecSupplier) = apply { delegate.addFunction(funSpec.get()) }
override fun addKdoc(kdoc: KDoc) = apply { delegate.addKdoc(kdoc.get()) }

Check warning on line 39 in kotlin-code-generation/src/main/kotlin/builder/KotlinCompanionObjectSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinCompanionObjectSpecBuilder.kt#L36-L39

Added lines #L36 - L39 were not covered by tests
override fun addModifiers(vararg modifiers: KModifier) = builder { delegate.addModifiers(*modifiers) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier): KotlinCompanionObjectSpecBuilder = apply { delegate.addProperty(propertySpec.get()) }
override fun addProperty(propertySpec: KotlinPropertySpecSupplier) = apply { delegate.addProperty(propertySpec.get()) }
override fun addType(typeSpec: TypeSpecSupplier) = builder { delegate.addType(typeSpec.get()) }
override fun tag(type: KClass<*>, tag: Any?) = builder { this.tag(type, tag) }

Check warning on line 43 in kotlin-code-generation/src/main/kotlin/builder/KotlinCompanionObjectSpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinCompanionObjectSpecBuilder.kt#L43

Added line #L43 was not covered by tests

fun addOriginatingElement(originatingElement: Element) = builder {
delegate.addOriginatingElement(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import io.toolisticon.kotlin.generation.spec.KotlinAnnotationSpecSupplier
import io.toolisticon.kotlin.generation.spec.KotlinConstructorPropertySpec
import io.toolisticon.kotlin.generation.spec.KotlinConstructorPropertySpecSupplier
import kotlin.reflect.KClass

/**
* Builder for [KotlinConstructorPropertySpec].
Expand All @@ -21,10 +22,8 @@
private val propertyBuilder: KotlinPropertySpecBuilder,
private val parameterBuilder: KotlinParameterSpecBuilder
) : Builder<KotlinConstructorPropertySpec>,
KotlinAnnotatableBuilder<KotlinConstructorPropertySpecBuilder>,
KotlinConstructorPropertySpecSupplier,
KotlinDocumentableBuilder<KotlinConstructorPropertySpecBuilder>,
KotlinModifiableBuilder<KotlinConstructorPropertySpecBuilder> {
KotlinAnnotatableDocumentableModifiableBuilder<KotlinConstructorPropertySpecBuilder>,
KotlinConstructorPropertySpecSupplier {

companion object {
fun builder(name: String, type: TypeName): KotlinConstructorPropertySpecBuilder = KotlinConstructorPropertySpecBuilder(
Expand All @@ -45,9 +44,10 @@
}
}

override fun addAnnotation(spec: KotlinAnnotationSpecSupplier): KotlinConstructorPropertySpecBuilder = apply { parameterBuilder.addAnnotation(spec) }
override fun addKdoc(kdoc: KDoc): KotlinConstructorPropertySpecBuilder = apply { parameterBuilder.addKdoc(kdoc) }
override fun addModifiers(vararg modifiers: KModifier): KotlinConstructorPropertySpecBuilder = apply{ propertyBuilder.addModifiers(*modifiers) }
override fun addAnnotation(spec: KotlinAnnotationSpecSupplier) = apply { parameterBuilder.addAnnotation(spec) }
override fun addKdoc(kdoc: KDoc) = apply { parameterBuilder.addKdoc(kdoc) }
override fun addModifiers(vararg modifiers: KModifier) = apply { propertyBuilder.addModifiers(*modifiers) }
override fun tag(type: KClass<*>, tag: Any?) = apply { propertyBuilder.tag(type, tag) }

Check warning on line 50 in kotlin-code-generation/src/main/kotlin/builder/KotlinConstructorPropertySpecBuilder.kt

View check run for this annotation

Codecov / codecov/patch

kotlin-code-generation/src/main/kotlin/builder/KotlinConstructorPropertySpecBuilder.kt#L50

Added line #L50 was not covered by tests

override fun build(): KotlinConstructorPropertySpec {
val parameter = parameterBuilder.build()
Expand All @@ -59,6 +59,7 @@

return KotlinConstructorPropertySpec(parameter = parameter, property = property)
}

override fun spec(): KotlinConstructorPropertySpec = build()
}

Expand Down
Loading