Skip to content
This repository was archived by the owner on Aug 5, 2021. It is now read-only.
This repository was archived by the owner on Aug 5, 2021. It is now read-only.

default methods on Java 8 Interfaces are not found #102

Closed

Description

@cpwright

If I have a class that implements an interface with a default method, then the method is not found. This is at least in part because in JType_ProcessClassMethods the methods array is fetched with JPy_Class_GetDeclaredMethods_MID instead of JPy_Class_GetMethods_MID for non-interface types.

If the method is not defaulted, this works fine because the JOverloadedMethod_FindMethod call will visit the super class when invoking a method, but it does not visit the interfaces.

If I swap the call to getDeclaredMethods for a getMethods call, then the interfaces are found; but the behavior about visiting superclasses is going to change; because the method would be found in the wrapped class itself instead of the superclass.

I'd like to fix this, but need to understand the design intent behind visiting the super class hierarchy instead of allowing the getMethods call to find the methods; because to be consistent with the super class logic I need to visit the interfaces, after exhausting the rest of the method hierarchy.

Activity

  1. forman commented on Sep 6, 2017

    @forman
    Member

    Hi, I've already merged your PR. Could you pls also provide a test case for the fix.

  2. cpwright commented on Sep 6, 2017

    @cpwright
    Author

    Thank you for merging. I've a pull request for the missing test case.

    #105

  3. added a commit that references this issue on Sep 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions