Hello!
Sorry if this was already discussed, but what about enums extending
sealed interfaces? E.g.:
sealed interface X permits Foo {}
enum Foo implements X { // can we do this?
A {}, // and what about this? Here we have an additional subclass at
runtime. Or we should explicitly declare
I've posted the javadoc output from some small examples of records and
sealed types.
Three of the examples, Point, BinaryNode and Holder, were suggested by
Brian as
commonly used examples. The last example, Coords, declares a sealed type
with
two different records as subtypes, just to show
switch to amber-spec-experts, because it's about the binary representation of a
Record in the classfile.
- Mail original -
> De: "Maurizio Cimadamore"
> À: "Harold David Seigel" , "amber-dev"
>
> Envoyé: Jeudi 10 Octobre 2019 22:03:23
> Objet: Re: Class.getRecordComponent() javadoc
- Mail original -
> De: "Alex Buckley"
> À: "amber-spec-experts"
> Envoyé: Jeudi 10 Octobre 2019 19:41:31
> Objet: Re: Fields and methods of a record are marked MANDATED
> Enum types are specified such that a `values` method is always
> implicitly declared. (If you declare one
Brian,
This distinction is covered under javax.lang.model.util.Elements.Origin.
https://docs.oracle.com/en/java/javase/11/docs/api/java.compiler/javax/lang/model/util/Elements.Origin.html
In other words, you should be able to determine if a member was provided
explicitly in source code, or
Enum types are specified such that a `values` method is always
implicitly declared. (If you declare one explicitly, you have two method
declarations with override-equivalent signatures, which is an error per
JLS 8.4.) Accordingly, the corresponding method in the class file should
always be
- Mail original -
> De: "Brian Goetz"
> À: "Remi Forax"
> Cc: "amber-spec-experts"
> Envoyé: Jeudi 10 Octobre 2019 17:57:46
> Objet: Re: PatternHandle in record
> The answers to these questions are beyond the scope of the record discussion,
> and while I’m happy to discuss them at some
Under that interpretation, that leaves record members in a funny place, since a
given mandated member (e.g., an accessor for a component) _might_ have been
explicit in the source, or might not have been. Should ACC_MANDATED describe
the member descriptor (“spec mandates a member with this
A mandated construct is one that is mandated by the specification, but not
explicitly declared. Constructs of that sort have been in the platform since
the beginning, such as default constructors. ACC_MANDATED was added to the
platform only more recently and has some exposure through
The answers to these questions are beyond the scope of the record discussion,
and while I’m happy to discuss them at some point, I would like to focus on
getting records out the door right now, so I ask your forbearance in not diving
down the pattern translation rabbit hole right now.
The
We should match the behavior of methods like `Enum::values`.
> On Oct 10, 2019, at 10:15 AM, Remi Forax wrote:
>
> Hi all,
> fields and methods of a record are marked ACC_MANDATED which contradict JLS
> 13.1.12 that explains that you can not use ACC_MANDATED on field and method.
>
>
Hi all,
fields and methods of a record are marked ACC_MANDATED which contradict JLS
13.1.12 that explains that you can not use ACC_MANDATED on field and method.
regards,
Rémi
Hi all,
ASM doesn't like too much weird method names,
exactly the ASMifier, that take a binary class and generate the Java code that
will create the same binary class, doesn't work well with the method named
"\%pattern\%RecordSubType\%(ILjava\|lang\|String\?)".
I have two questions:
- why do we
On 09/10/2019 19:34, Remi Forax wrote:
- Mail original -
De: "Remi Forax"
À: "Brian Goetz"
Cc: "amber-spec-experts"
Envoyé: Mercredi 9 Octobre 2019 18:44:23
Objet: Re: Record Component attributes
- Mail original -
De: "Brian Goetz"
À: "Remi Forax" , "amber-spec-experts"
On 10/10/2019 01:50, Brian Goetz wrote:
Right. We already restrict anon and lambda instances of the sealed
type. Not only can't we stably write down their types in the PS
attribute, but even if we could, it's so easy to accidentally lose
exhaustiveness.
This is a very good point; if I
15 matches
Mail list logo