Java Reflect/AOP override supertype private Method

Is it at all possible to “override” a private method of a super class in Java?

The class whose method I wish to override is a third party class so I cannot modify the source. It would be ideal if there were some way to reflectively set a method on a class.

Alternatively, if it is possible to intercept a private method of a third party class then this would be suitable.

Answer

Is it at all possible to “override” a private method of a super class in Java?

No

I don’t think using Reflection there would be a tweak , it will break OOP there

Leave a Reply

Your email address will not be published. Required fields are marked *