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

Ivan Gerasimov ivan.gerasimov at oracle.com
Fri Mar 7 08:29:18 UTC 2014


Resent with the correct Subject line
-------------------------------

Hello!

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.

BUGURL: https://bugs.openjdk.java.net/browse/JDK-8034044
WEBREV: http://cr.openjdk.java.net/~igerasim/8034044/0/webrev/

I ran tests from langtools/test/tools/javac/ with jtreg.
No failures were caused by this fix.


[1] http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5

Sincerely yours,
Ivan



More information about the compiler-dev mailing list