Updated document on data classes and sealed types

Kevin Bourrillion kevinb at google.com
Fri Mar 8 20:43:54 UTC 2019

Re: annotations,

Doc says, "Record components constitute a new place to put annotations;
we'll likely want to extend the @Target meta-annotation to reflect this."

I'm sure we discussed this before, but I also expect to be able to put any
METHOD-, FIELD- or PARAMETER-targeted annotation on a record component, and
have that annotation appear to be present on the synthesized
accessor/field/constructor-parameter. Is that sensible?

(As for records themselves, I expect they are targeted with TYPE just as
enums/interfaces/"plain old classes" (jeesh, is there any term that means
the latter?).)

On Fri, Mar 1, 2019 at 12:16 PM Brian Goetz <brian.goetz at oracle.com> wrote:

> I've updated the document on data classes here:
>      http://cr.openjdk.java.net/~briangoetz/amber/datum.html
> (older versions of the document are retained in the same directory for
> historical comparison.)
> While the previous version was mostly about tradeoffs, this version
> takes a much more opinionated interpretation of the feature, offering
> more examples of use cases of where it is intended to be used (and not
> used).  Many of the "under consideration" flexibilities (extension,
> mutability, additional fields) have collapsed to their more restrictive
> form; while some people will be disappointed because it doesn't solve
> the worst of their boilerplate problems, our conclusion is: records are
> a powerful feature, but they're not necessarily the delivery vehicle for
> easing all the (often self-inflicted) pain of JavaBeans.  We can
> continue to explore relief for these situations too as separate
> features, but trying to be all things to all classes has delayed the
> records train long enough, and I'm convince they're separate problems
> that want separate solutions.  Time to let the records train roll.
> I've also combined the information on sealed types in this document, as
> the two are so tightly related.
> Comments welcome.

Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at google.com

More information about the amber-spec-observers mailing list