-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Accessor #54
Comments
ClassTransform currently does not provide a way to make accessors in the Mixin way. I'm not a fan of this style because it goes against it's very own rule of never loading a mixin class. |
Can access be implemented using reflection not function? This will support hot-injection. |
That would just be regular reflection. No need to add that to ClassTransform |
I tried using an interface "Accessor" that provides a method "example" public interface Accessor {
void example();
} , and implementing it in a transformer "ATransformer" @CShadow(makePublic=true)
public native example(); , but this only makes it possible to access a method, not a field. ((Accessor) instance).example(); And how can I use an access function similar to this in case of hot injection if it doesn't support hot injection? |
Using an accessor interface is the same way I am doing this myself. It actually works with fields if you implement the method yourself and just return/set the accessed field. Hot injection using this way is sadly not possible. You have to resort to using reflection for that. |
Is there a way to implement non-Transformer-Class access to a class's non-public fields? I have come up with a solution:
in OtherClass:
((FooTransformer) (Object) fooInstance).bar();
in FooTransformer:
@CShadow(makePublic = true) public abstract void bar();
instead of the unsupported
fooInstance.bar();
。 Is this possible?The text was updated successfully, but these errors were encountered: