Re: [sealed] Sealed local classes?

2019-10-10 Thread Tagir Valeev
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

sample javadoc output for records and sealed types.

2019-10-10 Thread Jonathan Gibbons
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

Re: Class.getRecordComponent() javadoc doesn't specify its behavior if the accessor of a record component is not present

2019-10-10 Thread Remi Forax
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

Re: Fields and methods of a record are marked MANDATED

2019-10-10 Thread Remi Forax
- 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

Re: Fields and methods of a record are marked MANDATED

2019-10-10 Thread Jonathan Gibbons
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

Re: Fields and methods of a record are marked MANDATED

2019-10-10 Thread Alex Buckley
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

Re: PatternHandle in record

2019-10-10 Thread forax
- 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

Re: Fields and methods of a record are marked MANDATED

2019-10-10 Thread Brian Goetz
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

Re: Fields and methods of a record are marked MANDATED

2019-10-10 Thread Joe Darcy
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

Re: PatternHandle in record

2019-10-10 Thread Brian Goetz
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

Re: Fields and methods of a record are marked MANDATED

2019-10-10 Thread Brian Goetz
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. > >

Fields and methods of a record are marked MANDATED

2019-10-10 Thread Remi Forax
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

PatternHandle in record

2019-10-10 Thread Remi Forax
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

Re: Record Component attributes

2019-10-10 Thread Maurizio Cimadamore
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"

Re: [sealed] Sealed local classes?

2019-10-10 Thread Maurizio Cimadamore
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