Skip to content

KSP generates SimplePath for Comparable/Number types with @Convert annotation #1452

@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.

Describe the bug

Custom types used with @Convert annotation in KSP code generation are not generating correct QueryDSL path types. Types implementing Comparable or extending Number generate SimplePath<T> instead of ComparablePath<T> or NumberPath<T>. This is inconsistent with Java APT code generation, which correctly identifies types based on their hierarchy.

To Reproduce

@Entity
class Invoice(
    @Id val id: UUID,
    @Convert(converter = YearMonthConverter::class)
    val month: YearMonth?,  // Generates SimplePath<YearMonth> instead of ComparablePath<YearMonth>
    @Convert(converter = MoneyConverter::class)
    val amount: Money?,      // Generates SimplePath<Money> instead of NumberPath<Money>
)

data class Money(val value: BigDecimal) : Number(), Comparable<Money> {
    override fun compareTo(other: Money): Int = this.value.compareTo(other.value)
    // ... Number method implementations
}

Expected behavior

  • Types implementing ComparableComparablePath<T> (e.g., YearMonth)
  • Types extending Number and implementing ComparableNumberPath<T> (e.g., Money)

Type detection should be based on type hierarchy, not annotation presence.

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