Discussion on case clases implemented with jvm record?

My search skills are failing me. I thought there was an existing discussion on implementing case classes as JVM records (jep 395).

Does that ring a bell? If not, what is the conclusion there? Should case classes be implemented using records?

Not an expert, but I don’t know that there is a notion of “JVM records” outside the java.lang.Record class.

If a record is a constrained case class, then perhaps a case class that extends Record could be verified to obey those constrains, much as extending Enum signals a wish to conform to Java enums.

That would also answer the FAQ, how do I detect that a class is a case class.

I think there is more than extending java.lang.Record. On the JEP 395 page they describe “Class-file representation” of records. Which, afaict, does imply a record has a distinct compiled representation beyond extending a particular class:

Thanks, I missed that. It’s 4.7.30 in the spec.

I didn’t see further discussions except the proposal to make case classes use invoke dynamic like records do. But that is an implementation detail.

Which spec is that? I saw invoke dynamic mentioned in another discussion but I don’t know what that implies.


Would be interesting to define any tuple extending anyval have a record representation.