-
Notifications
You must be signed in to change notification settings - Fork 47
Safe Transformer Types #102
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
Conversation
This will probably have to wait for the 1.19 release cycle, because it's a deeply breaking change. |
This is a substantial change. What does it give us? Does it address any key bugs? |
This will be modlauncher 11. new major number. We'll need to update the entire stack. |
We might need to make sure we have backward compatibility due to problems with tech like mixins, which will require significant refactors to land on this. |
6c73b73
to
f9a5356
Compare
letsroll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ye
The issue
Currently, modlauncher determines the type of
ITransformer
s at runtime by getting their genericT
type. However, this fails when the interface is implemented in a parent class.See also:
Trouble with generics
To address the generics issue, we'll use even more generics.
We can't use bounded types because ASM Nodes don't share a common parent, and enums aren't an option either since they can't have generic parameters.
The solution
So, we'll introduce a transformer type class whose generic
T
type must correspond to the transformer'sT
type. And by making it a "fake enum" with predefined instances we can effectively limitITransformer
to those types.This type is then returned from the transformer in a new
getTargetType
method.Important disclaimer: This PR introduces BREAKING changes