JDK-8024808 : Lambda Spec: specify skipping of private methods during invokevirtual selection
Type:Bug
Component:specification
Sub-Component:vm
Priority:P3
Status:Closed
Resolution:Fixed
Submitted:2013-09-13
Updated:2014-02-26
Resolved:2013-09-13
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.
Longstanding behavior of HotSpot and other VMs is to ignore private methods during selection. This is inconsistent with the specification. But, given the legacy, the specification should be changed to encode it.
Comments
Updated JVMS text (5.4.5):
An instance method m1 declared in a class C overrides another instance method m2 declared in a class A iff ***either m1 is the same as m2, or*** all of the following are true:
- C is a subclass of A.
- m2 has the same name and descriptor as m1.
- ***m1 is not marked ACC_PRIVATE.***
- Either:
-- m2 is marked ACC_PUBLIC; or is marked ACC_PROTECTED; or is marked neither ACC_PUBLIC nor ACC_PROTECTED nor ACC_PRIVATE and belongs to the same run-time package as C, or
-- m1 overrides a method m3, m3 distinct from m1, m3 distinct from m2, such that m3 overrides m2.