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

Backend: Add Kotlin mixins #1981

Open
wants to merge 10 commits into
base: beta
Choose a base branch
from

Conversation

ThatGravyBoat
Copy link
Contributor

@ThatGravyBoat ThatGravyBoat commented Jun 3, 2024

What

This adds an annotation processor to allow for a new form of mixin creation called KMixin these allow for a more defined specified control of mixins, unlike normal mixins these are written in Kotlin only.

The following is the specification of the current KMixin.

  • KMixin is defined by either the @KMixin annotation or @KPseudoMixin
  • KMixins can only be defined on an object
  • Mixins can contain other code other than injects and redirects, these unlike normal mixins wont be copied to the mixined class.
  • If you need the instance of the class you are mixining into in a function you can use the @KSelf annotation along with a variable and the type of the class
  • If you need to shadow a field you can do @KShadow and then the name of the field and then the type
  • Additionally you can do @KShadow(ShadowKind.METHOD) to shadow a method, to do this you must have the type be a function of the arguments and return of the method you want to shadow.
  • If an inject needs to be applied to a static method you can use the @KStatic annotation
  • For redirects of methods you use the @KRedirectCall annotation
  • For redirecting fields you use the @KRedirectField annotation, depending on the return type and the arguments it will determine if this is a redirect of a get or put field.
  • For basic injects you use the @KInject annotation.
  • For injects which need to inject a specific method you use the @KInjectAt annotation.

Note

More injectors can easily be added by adding a new InjectorSerializer to the Injectors.serializers map

Changelog Technical Details

  • Added KMixin (Kotlin mixins). - ThatGravyBoat

@CalMWolfs CalMWolfs self-requested a review June 3, 2024 04:04
Copy link
Collaborator

@CalMWolfs CalMWolfs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worked for me

@CalMWolfs CalMWolfs added Soon This Pull Request will be merged within the next couple of betas Backend A backend pull request that will be merged soon labels Jun 3, 2024
@CalMWolfs CalMWolfs added this to the Version 0.26 milestone Jun 3, 2024
@github-actions github-actions bot added the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 8, 2024
Copy link

github-actions bot commented Jun 8, 2024

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
@github-actions github-actions bot removed the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 8, 2024
Copy link

github-actions bot commented Jun 8, 2024

Conflicts have been resolved! 🎉

Copy link

github-actions bot commented Jun 9, 2024

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

@github-actions github-actions bot added the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 9, 2024
# Conflicts:
#	src/main/java/at/hannibal2/skyhanni/mixins/hooks/GuiContainerHook.kt
Copy link

github-actions bot commented Jun 9, 2024

Conflicts have been resolved! 🎉

@github-actions github-actions bot removed the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 9, 2024
@hannibal002 hannibal002 removed the Soon This Pull Request will be merged within the next couple of betas label Jun 14, 2024
@github-actions github-actions bot added the Merge Conflicts There are open merge conflicts with the beta branch. label Jun 23, 2024
Copy link

This pull request has conflicts with the base branch "beta". Please resolve those so we can test out your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend A backend pull request that will be merged soon Merge Conflicts There are open merge conflicts with the beta branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants