Hi Dan, ----- Mail original ----- > De: "daniel smith" <daniel.sm...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr> > Cc: "Gavin Bierman" <gavin.bier...@oracle.com>, "amber-spec-experts" > <amber-spec-experts@openjdk.java.net> > Envoyé: Lundi 13 Avril 2020 21:13:51 > Objet: Re: Record component type can be an inner class of a record
>> On Apr 13, 2020, at 11:08 AM, fo...@univ-mlv.fr wrote: >> >> I believe you're right, the following code should not compile, apart if you >> want >> to write puzzler for a living :) >> >> class A { int y; } >> >> record B(A a) implements I { >> public static void main(String[] args) { >> System.out.println(new B(null).a().x); >> } >> } >> >> interface I { >> class A { int x; } >> } > > You're proposing a novel error check, which I'm not sure is a good idea. I think you mis-read it. It's an example that shows that depending if the record component type is resolve as part of outside of the record or inside the record, not the same A is picked. The A at top level declare a field "y" while the A inside I declare a field "x", that why it doesn't compile. So it's not a new error check. regards, Rémi