We are currently in the process of migrating our codebase from KSP1 to KSP2 (we are updating to Kotlin 2.2.20 + KSP 2.2.20-2.0.4).
I've noticed a behavioural difference on KSP2 w.r.t. to how getAllProperties() handles annotations coming from multiple sources from inherited properties.
I wrote a simple MRE to showcase the issue; but in essence we have:
interface HasName {
val name: String
}
abstract class BaseEntity {
@Column(name = "name") lateinit var name: String
}
@InspectProperties
class WithInterface : BaseEntity(), HasName
Before (with KSP1), the annotations in the properties returned by getAllProperties() would include the @Column interface as I'd expect. On KSP2, it is no longer included. As far as I can tell, this only happens if:
@Column is defined as a Java interface
- the class inherits from two sources (an abstract class and an interface) that both declare the same column
Feel free to browse the complete MRE on my repo; there is a ./scripts/run.sh script to make it easier to see and play around with.