Skip to content

Support underlying type extraction for Kotlin value classes in KSP codegen #1403

@jbl428

Description

@jbl428

Important Notice

Thank you for opening an issue! Please note that, as outlined in the README, I currently only work on feature requests or bug fixes when sponsored. Balancing this project with professional and personal priorities means I have a very limited amount of effort I can divert to this project.

You must put in the work to address this issue, or it won't be addressed.

  • I am willing to put in the work and submit a PR to resolve this issue.

Is your feature request related to a problem? Please describe.

Currently, when KSP codegen encounters a column whose type is a Kotlin value class,

it fails with an error similar to:

Error processing com.example.domain.Entity.fieldName: Type was not recognised, This may be an entity that has not been annotated with @Entity, or maybe you are using javax instead of jakarta.

It would be more useful if it used the underlying wrapped type instead.

Expected behavior:

@JvmInline
value class Email(
    val value: String
)

@Entity
class Person(
    @Id
    val id: Int,
    val email: Email,
)

public class QPerson : EntityPathBase<Person> {
    public val id: NumberPath<Int> = createNumber("id", kotlin.Int::class.javaObjectType)

    public val email: StringPath = createString("email")
}

Describe the solution you'd like

Make TypeExtractor.kt consider kotlin value class and return KSType as inner type

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