RFR  Class.getModifiers() returns "static" for anonymous classes
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?
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 .
>>> However, in OpenJDK implementation Class#getModifiers(), when called
>>> the anonymous class, returns the STATIC bit set.
>>> Would you please help review the proposed fix, which removes STATIC
>>> 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
> Ok, I'll remove STATIC from the enum bodies too.
> Sincerely yours,
More information about the compiler-dev