I'm using an external library (which I can't modify) with classes A and B, both having 2 getters named the same (getter1 and getter2).
There is no relationship between A and B, no super class or interface defining the 2 getters.
In my code, I want to create a method with a parameter that can be either of type A and B, on which I want to call the getters (without caring if the passed parameter is an instance of A or of B).
I can declare an interface with getter1 and getter2, but I can't force the classes A and B to implement this interface, since they reside in an external code.
What would be an elegant solution for the method in my code?
I don't want to have 2 identical methods, one with an A parameter, one with a B parameter.