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

Fixes and improvements for retrieving IMixinInfo from ClassInfo #529

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

comp500
Copy link

@comp500 comp500 commented Oct 8, 2021

In MixinInfo#postApply, the MixinInfo reference was being added to the ClassInfo of the mixin itself, rather than the classes the mixin is applied to. This meant that Mixins.getMixinsForClass would only return MixinInfo on mixin classes themselves, not their target classes, and ClassInfo#getAppliedMixins() was empty for target classes.

This change fixes the behaviour to resolve the ClassInfo of the target class and add the MixinInfo to that.

In MixinInfo#postApply, the MixinInfo reference was being added to the
ClassInfo of the mixin itself, rather than the classes the mixin is
applied to. This meant that Mixins.getMixinsForClass would only return
MixinInfo on mixin classes themselves, not their target classes, and
ClassInfo#getAppliedMixins() was empty for target classes.
This change fixes the behaviour to resolve the ClassInfo of the target
class and add the MixinInfo to that.
Allow external code to query the list of mixins that target a class,
including mixins that were not applied, by exposing getMixins; this
method wasn't used internally but exposing it allows external error
handlers greater visibility of mixins targeting a class.

ClassInfo.mixin is also exposed with getMixinInfo to allow external
code to retrieve mixin metadata from a class. This supersedes the need
for some other methods like isMixin and isLoadable, but these are kept
for compatibility.
@comp500 comp500 changed the title Add applied MixinInfo to target class rather than mixin class Fixes and improvements for retrieving IMixinInfo from ClassInfo Aug 14, 2023
@comp500
Copy link
Author

comp500 commented Aug 14, 2023

Rebased on top of 0.8.5 (155314e). I was informed that a mod uses the current broken behaviour, so I've added methods to expose IMixinInfo in more places and provide greater flexibility:

Allow external code to query the list of mixins that target a class, including mixins that were not applied, by exposing getMixins as a public method; this method wasn't used internally but exposing it allows external error handlers greater visibility of mixins targeting a class.

ClassInfo.mixin is also exposed with getMixinInfo to allow external code to retrieve mixin metadata from a class. This supersedes the need for some other methods like isMixin and isLoadable, but these are kept for compatibility.

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