vendredi 11 mai 2018

Change a private method in java from subclass

Like the title says: is there ANY way to change a private method in Java from a subclass, but only have it affect calls to that subclass?

Lets say class 'X' (which I can edit) extends class 'Y' (which I can't). Y has a method that references a protected method in another class in the same package, which it can access, since they're in the same package, but X can't, because it's in a different one. It also references multiple private fields.

I want to change a getter referenced in that method, without copying the whole method, fields and reflecting for the protected method.

I can see the source of Y, but I can't edit it.





Aucun commentaire:

Enregistrer un commentaire