RFR [8034044] Class.getModifiers() returns "static" for anonymous classes
Ivan Gerasimov
ivan.gerasimov at oracle.com
Mon Mar 10 17:14:10 UTC 2014
I removed the STATIC bit from the modifiers of the enum body.
Jtreg test is updated accordingly.
No new jtreg/jck test failures.
Would you please help review the updated webrev?
http://cr.openjdk.java.net/~igerasim/8034044/1/webrev/
Sincerely yours,
Ivan
On 07.03.2014 22:39, Ivan Gerasimov wrote:
> Thank you Alex!
>
> On 07.03.2014 22:10, Alex Buckley wrote:
>> On 3/7/2014 12:29 AM, Ivan Gerasimov wrote:
>>> JLS states that an anonymous class cannot be static [1].
>>> However, in OpenJDK implementation Class#getModifiers(), when called
>>> for
>>> the anonymous class, returns the STATIC bit set.
>>> Would you please help review the proposed fix, which removes STATIC
>>> from
>>> the anonymous class's modifier?
>>>
>>> An exception to this is an enum constant's body.
>>> It's not clear, whether they should be treated in the same way as
>>> anonymous classes, so I left them as they are now.
>>
>> JLS 8.9.1: The optional class body of an enum constant implicitly
>> defines an anonymous class declaration (§15.9.5) that extends the
>> immediately enclosing enum type.
>>
>> So the class generated for an enum constant's body should not be
>> ACC_STATIC.
>>
>
> Ok, I'll remove STATIC from the enum bodies too.
>
> Sincerely yours,
> Ivan
>
>> Alex
>>
>
>
>
>
More information about the compiler-dev
mailing list