JDK-8028520 : JVM should not throw VerifyError when a private method overrides a final method
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 7u45,8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2013-11-18
  • Updated: 2014-06-26
  • Resolved: 2013-11-22
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.
JDK 7 JDK 8 Other
7u60Fixed 8Fixed hs25Fixed
Related Reports
Relates :  
Relates :  
Accessibility of an "overriding method" should be consistent with  the JLS. That means a private method is not deemed to override anything during execution and matches the existing hotspot behavior during method selection in invokevirtual.   The verifier would also consider the accessibility and not throw VerifyError if a private method has the same name/descriptor as it superclass' final method. 
Release team: Approved for fixing

SQE is OK with fixing this, we need this change to comply with the spec.

The justification for checking this fix into JDK 8 is that it is a default methods related bug fix that will prevent the verifier from throwing VerifyError exceptions in cases where it should not. The fix undoes a change that was erroneously made in JDK 7u45. Additionally, this fix brings the JVM more in line with the JVM Spec and JL Spec rules for method overriding. There is no workaround for this bug. The fix should be integrated by 21-Nov-2013. It is currently out for review. The risk is small because the fix restores the behavior to what it was before JDK 7u45. Previous releases (JDK 7, 6, 5, etc.) have the same behavior that this fix restores. Also, this fix was tested with JCK Lang and VM tests, vm quicktests, hotspot jtreg tests, JPRT, and default method tests. The fix consists of a one line change to hotspot file classFileParser.cpp and a seven line change to an existing jtreg test. The modified jtreg test (test/runtime/finalFinalizer) provides adequate test coverage.

Release team: Please provide the details needed for critical requests + ensure QA is OK with this.

The JVMS is being clarified to bring it more in line with the JLS with respect to overriding. Pertinent to this bug's case, the JVMS will say that a private method does not override anything. See bug JDK-8028549 for more details about the JVMS changes.

What does the JVMS say about this? There are often discrepancies between the JLS rules that must be enforced at compilation time, and the JVMS verification rules that need to account for separate compilation. Just because something would not compile does not mean that it is automatically something the verifier should fail.