Mixin - How to shadow a field with private Inner class?


#1

Hello, I use this forum for the first time, so I may be using it incorrectly. I’m sorry.

@Shadow
private HogeClass.PrivateInnerClass example;

I want to shadow a field that type is private inner class. How can I shadow it?


#2

You may be able to solve this with access transformers. If you can’t, then it’s not possible with current mixin.


#3

Depending on what you’re doing, you could also use reflection to access the field - you can then Mixin to the inner class, add an interface to it and expose the methods you need that way (you can mixin using the Mixin annotation like so).

Note that this has been requested on the Mixin github, with reflection as the stop-gap answer:

and a similar (though not the same) problem has been asked about on the forums

We don’t have much on what you’re trying to do so can’t really advise further (though not sure if I could anyway), but there are ways around it if you try hard enough!