-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
AbstractMethodError for default method on base class interface #461
Comments
Having had a chance to look at this. Here's what I've found so far. It is probably a bug. IKVM implements default interface methods as Miranda methods. That is, methods which are implicitely created on sub-types based on the declaration on the extended super type. We do this because historically .NET has not supported any notion of default interface methods. Core does now, but Framework still does not. In this case, CommandInteractionPayload exposes the method getName() as an abstract. Because it is an interface with no default implementation. CommandInteractionPayloadMixin implements CommandInteractionPayload, and redeclares the method as an override with a default. Thus, anybody extending CommandInteractionPayloadMixin, should derive a miranda implementation from CommandInteractionPayloadMixin. However, the interface SlashCommandInteraction implements CommandInteraction which implements CommandInteractionPayload. But does NOT implement CommandInteracationPayloadMixin. So there are two paths to getName(). One through an interface tree, and the other through the implementation tree, where the implementation tree contains the default implementation, but the interface tree does not. I guess this is what they mean by a mixin: a set of default implementations for interfaces which can optionally be declared. I'm going to have to sit down with the JVM spec for awhile and figure out what we're supposed to be doing here, and whether we're doing what we're supposed to be doing. But what I think is happening is that when discovering the implemented methods, we go in order of implementation expressed by the class file metadata, which expresses the hierarchy. And since the Mixin appears later, at that time, we've already traversed an interface hierarchy where no default implementation existed. Essentially we're seeing getName on CommandInteractionPayload with no body before we encounter CommandInteractionPayloadMixin with a body. |
Repro project:
IkvmIssueRepro.zip
Basically
SlashCommandInteractionEvent
internally holds instance of SlashCommandInteractionImpl which is subclass of CommandInteractionImpl that implements interface CommandInteractionPayloadMixin with default method body forgetName()
But when i try to call
![image](https://private-user-images.githubusercontent.com/94796179/291007279-4138d3a7-2aa5-452f-b100-87280a26f238.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwNTkyNzUsIm5iZiI6MTcxOTA1ODk3NSwicGF0aCI6Ii85NDc5NjE3OS8yOTEwMDcyNzktNDEzOGQzYTctMmFhNS00NTJmLWIxMDAtODcyODBhMjZmMjM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDEyMjI1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNhMmU1NGMyNjNhMDU4Yzc0YWJiZjA1ZjRmZWNkYjRhYWFkODQ5OTRhNjljY2FkM2U0NjU2ZWEyNmQ5YmUzNTcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.lA8bLZoVsZU4cou3VDzZQgZ9X6wJPJyljA8jMzl99ts)
getName()
it throwsjava.lang.AbstractMethodError
as ikvm has generated for it (see screenshot)The text was updated successfully, but these errors were encountered: