JDK-4396587 : "A private method and all methods declared in a final class are final"
  • Type: Bug
  • Component: specification
  • Sub-Component: language
  • Affected Version: 1.4.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: generic
  • Submitted: 2000-12-08
  • Updated: 2007-09-25
  • Resolved: 2007-09-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 1.5Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The text in the synopsis appears in section 8.4.3.3 (final methods).

There are two problems with this sentence. First, "declared in" should more correctly be "of" because of inner classes. Specifically, methods of inner classes need not necessarily be final just because the outer class is final.

The more serious problem is that this sentence should just be removed. While the sentence is a useful exposition on the consequences of language rules appearing elsewhere, this sentence (if left in the spec) would have additional consequences beyond that, and these additional consequences aren't correct.

Specifically, see bugs 4249112 and 4386357. Those bugs show that the current compilers do NOT expose this implied finalness to the reflection interface. What's worse, we can't change this in the compiler to comply with the current wording because it would introduce a serialization incompatibility in the libraries, documented in bugid 4249112.

So my suggestion is to simply remove this sentence or reword it so that it is clearly just useful exposition and not a language rule.

neal.gafter@Eng 2000-12-08

Comments
EVALUATION This is a familiar issue. We could do with a clarification, even though I don't see it as a real bug. I've tweaked the 3rd edition draft slightly, so that it says something weaker (methods behave as if they were final) and also says that the methods in question are "declared immediately within a final class" to address the concern over nested classes. gilad.bracha@eng 2001-01-04
04-01-2001