Paul Griffith
09/20/2021, 6:08 PMval
? š§µ ->val
member of the class that is, if you call the primary data class constructor, null, or if you use the secondary constructor, whatever you supplied. I do not want this field to be in equals/hashcode...but I also don't really want to write my own equals & hashcode, and this seems reasonable (albeit an edge case)Joffrey
09/20/2021, 6:39 PMdeferredType
with null
default value in the primary constructor?
data class Attribute constructor(
override val name: String,
override val location: String,
override val description: String? = null,
override val kind: Kind = Kind.INSTANCE_MEMBER,
private val deferredType: TypeSupplier? = null,
) : CompletionDescriptor()
Paul Griffith
09/20/2021, 6:40 PMhashcode
in that case, and TypeSupplier
is a SAM with no meaningful equals/hashcode implementation@Omit
annotation would be ideal but searching this Slack makes it seem like the official suggestion is just to override equals & hashcode yourselfJoffrey
09/20/2021, 6:41 PMPaul Griffith
09/20/2021, 6:41 PMJoffrey
09/20/2021, 7:32 PMdata class Attribute constructor(
override val name: String,
override val location: String,
override val description: String? = null,
override val kind: Kind = Kind.INSTANCE_MEMBER,
) : CompletionDescriptor() {
override var deferredType: TypeSupplier? = null
private set
constructor(
name: String,
location: String,
description: String? = null,
kind: Kind = Kind.INSTANCE_MEMBER,
deferredType: TypeSupplier? = null,
) : this(
name, location, description, kind
) {
this.deferredType = deferredType
}
}
Paul Griffith
09/20/2021, 8:03 PM