Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [] [jakartaee-ambassadors] Re: Java Records and Jakarta EE

On Thu, Jan 13, 2022 at 09:11:43AM +0100, Erik Brangs wrote:
> > What are your thoughts? Does it make sense?
> According to its JEP ( ), records are supposed to be immutable collections of values. The non-goals section even mentions that the goal is not to support POJOs or reduce boilerplate in general.
> There are already ways to use classes without a default constructor in some specifications (e.g. constructor expressions in JPA).
> Therefore I would like to see solid proposals and much more information on 1. before I even consider that a JEP would be a good idea. Specifications should only support records when it provides enough value for the developer.

I do not think it makes sense. The SE folks made it very clear in the JEP that Eric cited
that records are totally neither suitable nor intended for use in any API that needs mutable
data objects, eg., JPA. Just use regular classes (and maybe let your IDE or Lombok do some of the
grunt work?).

Or if this is really about boilerplate, heck, write a RecordClassMaker that reads the .class
of a record and generates a POJO .java for you to annotate. A terrible idea, but there it is :-)

Back to the top