Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

Using builder as annotation argument not working #17

@sanderdg

Description

@sanderdg

When I create a builder for a class it works fine. But when I used this as an argument for a third party library annotation it causes the build to fail. Maybe this could never work but I'm trying to understand why it is happening. Kapt annotation processing is performed before doing any other actions, right? I've created a small example to illustrate this (created my own annotation for simplicity sake):

fun main(args: Array<String>) {
    val foo = FooBuilder().id(UUID.randomUUID().toString()).build()
    println("Foo id = " + foo.id)
}

@Builder
@FooAnnotation(builder = FooBuilder::class) // error: cannot find symbol
class Foo(
    val id: String
)

@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASS)
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
annotation class FooAnnotation(
    val builder: KClass<*>
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions