RFR [8034044] Class.getModifiers() returns "static" for anonymous classes

Ivan Gerasimov ivan.gerasimov at oracle.com
Fri Mar 7 18:39:45 UTC 2014

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 

Ok, I'll remove STATIC from the enum bodies too.

Sincerely yours,

> Alex

More information about the compiler-dev mailing list