<https://twitter.com/sdeleuze/status/1095714310712...
# spring
m
won’t explicit override do?
Copy code
override fun getId(): Long? = this.id
s
With non
data
classes it works yes, even if ugly
Copy code
class User(
		id: Long?,
		val firstName: String,
		val lastName: String) : Persistable<Long?> {

	override fun isNew() = (id == null)

	override fun getId(): Long? = this.id
}
With
data
classes there is a declaration clash
Or it can work if you use another name for
id
, so still pretty ugly
Oh and your proposal won't work because the is confusion between the property and the getter, so infinite recursion
m
im sure there’s another ugly way around recursion. but why not have dedicated support for kt properties in spring then? pretty sure, kt-6653 won’t be resolved
t
this is not just a spring issue, maybe worth sharing in #general. it is really a kotlin/java limitation
m
yes it’s true, but not that serious imho. you can still do anything you want to do, just less pretty for very specific cases.
👍 1
just wanted to point out there’s at least one or two alternative solutions for spring-data which can be pretty without waiting that kt-6653 happens some day.
👍 1