RFR 8159751: ObjectStreamClass: hide 'final' flag for anonymous classes
Dan Smith
daniel.smith at oracle.com
Thu Jun 23 16:55:01 UTC 2016
> On Jun 23, 2016, at 8:51 AM, Roger Riggs <roger.riggs at oracle.com> wrote:
>
> Hi Dan,
>
> Is setting ACC_FINAL for anonymous inner classes a unique feature of the latest bytecode version?
> (javac -target 9)
>
> Was it always clear in class files with earlier bytecode versions?
This is a choice that the compiler makes, subject to the constraints of the Language Specification. At the moment, ACC_FINAL does not get set*. The outcome I expect from JDK-8129576 is to always set it, regardless of target version, since that's what the spec has always said. I suppose we could consider guarding the change on target version, but anyway that wouldn't affect the behavior of serialization either way, since this patch causes it to always ignore ACC_FINAL.
(* Actually, we found a bug in which it sometimes gets set on the class's flags, but still remains unset in the flags provided by the InnerClasses attribute. The latter is what you get from Class.getModifiers, so this bug hasn't affected serialization.)
—Dan
More information about the core-libs-dev
mailing list