pkl icon indicating copy to clipboard operation
pkl copied to clipboard

codegen-java: Support generating record classes

Open odenix opened this issue 1 year ago • 4 comments

codegen-java should support generating record classes instead of regular classes whenever possible. (codegen-kotlin already generates data classes whenever possible.)

I have this almost working, but one important question remains: how to deal with backward compatibility?

One option is to introduce a —generate-records flag and only generate record classes if this flag is set. Another option is to ask users to stay on the 0.27 code generator until they are ready to switch to record classes. In any case, generating record classes should eventually become the default.

odenix avatar Nov 12 '24 20:11 odenix

Yeah, definitely. Now with Java 11 dropped, the code generator should generate records. I think this is okay as a breaking change (generate java records by default, require flag to retain old behavior).

bioball avatar Nov 13 '24 00:11 bioball

Blocked on #790.

odenix avatar Nov 19 '24 00:11 odenix

Blocked on #790.

So that might mean unblocked now then? 🤞

raymyers avatar Jan 10 '25 00:01 raymyers

Implementation: https://github.com/apple/pkl/pull/970

bioball avatar Mar 01 '25 00:03 bioball