RFR: 8356941: AbstractMethodError in HotSpot Due to Incorrect Handling of Private Method [v3]

Dan Heidinga heidinga at openjdk.org
Fri Jul 18 14:17:51 UTC 2025


On Wed, 16 Jul 2025 07:20:16 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Private methods should never be considered as the implementation of a default method.
>> 
>> The first commit adds some additional logging I used to track down what was happening. I like it, but if reviewers think it too much I can drop it.
>> 
>> The second commit is the actual fix to exclude private methods, and adds the missing test case to the existing defmeth tests.
>> 
>> Testing:
>>  - tiers 1-4
>> 
>> Thanks
>
> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Revert "Additional logging to identify the problem"
>   
>   This reverts commit 60871844d32cbc58ea97b2186a2758e85613afa4.

Current change is also fine.  Both suggestions are more for leaving breadcrumbs to help the next person to dig thru this code

src/hotspot/share/classfile/defaultMethods.cpp line 667:

> 665:         if (!already_in_vtable_slots(slots, m)) {
> 666:           Method* impl = klass->lookup_method(m->name(), m->signature());
> 667:           if (impl == nullptr || impl->is_overpass() || impl->is_static() || impl->is_private()) {

Trying to capture your and Coleen's discussion in a comment.  Does this correctly cover the gist of the discussion?

Suggestion:

         // Unless the klass provides a non-static public or package-private method for this name
         // & sig combo, we need to add the EmptyVtableSlot so default method processing finds
         // the correct candidate to fill in the slot later.
          if (impl == nullptr || impl->is_overpass() || impl->is_static() || impl->is_private()) {

-------------

Marked as reviewed by heidinga (no project role).

PR Review: https://git.openjdk.org/jdk/pull/26302#pullrequestreview-3033634330
PR Review Comment: https://git.openjdk.org/jdk/pull/26302#discussion_r2216102680


More information about the hotspot-runtime-dev mailing list