JDK-4249112 : Compiler does not mark methods of final classes as final
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic,windows_2000
  • CPU: generic,x86
  • Submitted: 1999-06-23
  • Updated: 1999-09-23
  • Resolved: 1999-09-23
Related Reports
Duplicate :  
Relates :  
Description
Methods declared in a final class are final (JLS 8.4.3.3) and should
presumably be marked as such in the classfile.

william.maddox@Eng 1999-06-23

The spec does not require that the ACC_FINAL bit actually be set for these
methods in the classfiles.  It is sufficient that the class be final, and
therefore cannot be subclassed, to insure that the methods cannot be overridden.
This is presumably the intent of the spec.  In any case, the compiler has not
set the ACC_FINAL bits for such methods in the past, and doing so introduces
serialization incompatibilities.  In the absence of an explicit statement in
the spec that the implicit final-ness of these methods be explicitly marked
in the classfile with the ACC_FINAL bit, we will leave it unset.

william.maddox@Eng 1999-09-23

Comments
EVALUATION This was fixed in 1.3fcs-A, but broke serialization compatibility of some java.security classes. Apparently, the old compiler didn't set ACC_FINAL either. The fix will be backed out for the time being. william.maddox@Eng 1999-08-31 See 4396587; the spec is being brought into line with the compiler's behavior. neal.gafter@Eng 2001-01-04
31-08-1999