RFR: JDK-8235778: No compilation error reported when a record is declared in a local class
Vicente Romero
vicente.romero at oracle.com
Thu Dec 12 00:36:18 UTC 2019
On 12/11/19 7:08 PM, Maurizio Cimadamore wrote:
>
> If sym.isLocal() returns true, is this check
>
> && (sym.owner.flags_field & STATIC) == 0)
you are right there is no need for this check
> Needed? Aren't we inside a record declaration that is contained in
> some local context (e.g. within a method body), whose immediate
> enclosing type is a type T? If so, isn't T always non-static? I guess
> yes, unless T is a record itself, like:
>
> void m() {
> record A() {
> record B() { }
> }
> }
>
> The patch seems to be biased in favor of this - is it deliberate?
> (also there's no test around that). Should the spec say something?
this could be a good example to add to the spec. I will also add a test
case covering this case
>
> Maurizio
Thanks,
Vicente
>
> On 11/12/2019 23:39, Vicente Romero wrote:
>> Hi,
>>
>> Please review the fix for [1] at [2]. Records are not allowed to be
>> defined inside inner classes. This patch extends the check to local
>> inner classes which was missing.
>>
>> Thanks,
>> Vicente
>>
>> https://bugs.openjdk.java.net/browse/JDK-8235778
>> http://cr.openjdk.java.net/~vromero/8235778/webrev.00/
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20191211/8c75dffa/attachment-0001.htm>
More information about the compiler-dev
mailing list