-
Enhancement
-
Resolution: Not an Issue
-
P4
-
None
-
1.4.1
-
x86
-
windows_2000
Name: gm110360 Date: 11/11/2002
FULL PRODUCT VERSION :
jdk 1.4.1 and earlier versions
FULL OPERATING SYSTEM VERSION :
Win2000
A DESCRIPTION OF THE PROBLEM :
jls states, that anonymous classes are implicit final.
But it seems, the class-files are not marked as such.
An anonymous class is compiled to a separate class-file
named like SomeClass$1 . When I open this class-file with
JBuilder, it is (somewhat) decompiled, but shows no 'final'
modifier.
Nothing prevents me to compile and run something like:
Object o = new SomeClass$1() {};
in another class in the same package.
I think, this is not intended. I don't have headache from
this - but I just want to be sure, that the VM can
immediatly use the fact, that an anonymous class (and it's
methods) is final, without too much 'hotspotting'.
Typical application of anonymous classes like comparators
would immediatley benefit from this.
I propose to explicitly mark class files compiled from
anonymous classes as 'final'.
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 166886)
======================================================================
FULL PRODUCT VERSION :
jdk 1.4.1 and earlier versions
FULL OPERATING SYSTEM VERSION :
Win2000
A DESCRIPTION OF THE PROBLEM :
jls states, that anonymous classes are implicit final.
But it seems, the class-files are not marked as such.
An anonymous class is compiled to a separate class-file
named like SomeClass$1 . When I open this class-file with
JBuilder, it is (somewhat) decompiled, but shows no 'final'
modifier.
Nothing prevents me to compile and run something like:
Object o = new SomeClass$1() {};
in another class in the same package.
I think, this is not intended. I don't have headache from
this - but I just want to be sure, that the VM can
immediatly use the fact, that an anonymous class (and it's
methods) is final, without too much 'hotspotting'.
Typical application of anonymous classes like comparators
would immediatley benefit from this.
I propose to explicitly mark class files compiled from
anonymous classes as 'final'.
REPRODUCIBILITY :
This bug can be reproduced always.
(Review ID: 166886)
======================================================================
- relates to
-
JDK-6520152 ACC_FINAL flag for anonymous classes shouldn't be set
- Closed
-
JDK-4243945 javac of Kestrel-F produces incompatible anonymous classes
- Closed
-
JDK-7064370 Anonymous inner class in incorrectly non-public
- Closed
-
JDK-8161009 15.9.5: Anonymous classes aren't actually 'final'
- Closed
-
JDK-8034044 Class.getModifiers() returns "static" for anonymous classes
- Closed
-
JDK-8129576 Anonymous classes are not final according to reflection API
- Closed
(1 relates to)