Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MissingMethodException when proxying interfaces containing sealed methods #621

Merged
merged 3 commits into from
Jul 22, 2022

Conversation

stakx
Copy link
Member

@stakx stakx commented May 17, 2022

This is a first small step towards support for default interface methods (#447).

Not certain whether this warrants a changelog entry on its own, since what is being fixed here never got reported as an issue. Perhaps we just wait with a changelog entry until we have fully addressed #447?

P.S.: marking this as a draft as it may be incomplete; the same issue may still be present with proxies that have a target.

@stakx stakx force-pushed the bugfix/sealed-interface-methods branch 2 times, most recently from 228d0e7 to b5eddd2 Compare May 17, 2022 16:18
@stakx stakx marked this pull request as draft May 17, 2022 16:50
@stakx stakx mentioned this pull request May 20, 2022
@stakx stakx force-pushed the bugfix/sealed-interface-methods branch from b5eddd2 to 95819d5 Compare July 22, 2022 19:31
Two changes need to be made to `InterfaceMembersCollector`:

 1. `AcceptMethod` needs to be called with `onlyVirtuals: true`, so that
    it will filter out non-overridable methods during pre-screening.

 2. For such filtered-out methods, it needs to return `null` in order to
    avoid `MinimalisticMethodGenerator` (which would mark the method it
    creates as an override).

These changes have been copied from `ClassMembersCollector`. Note that
the two classes are now almost identical.
@stakx stakx force-pushed the bugfix/sealed-interface-methods branch from 95819d5 to 9c58968 Compare July 22, 2022 19:31
@stakx stakx marked this pull request as ready for review July 22, 2022 19:32
@stakx
Copy link
Member Author

stakx commented Jul 22, 2022

This may not be totally complete (the same problem may persist for other proxy types) but it's still a step in the right direction. So instead of letting this rot away, I'll merge it. I'll likely pick this topic up again as I'm still working on better support for new interface capabilities.

@stakx stakx merged commit 4b85681 into castleproject:master Jul 22, 2022
@stakx stakx deleted the bugfix/sealed-interface-methods branch July 22, 2022 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants