It sounds like the method really should be static (i.e. it doesn t access any data members and it doesn t need an instance to be invoked on). Since you used the term "static class", I understand that the whole class is probably dedicated to utility-like methods that could be static.
However, Java doesn t allow the implementation of an interface-defined method to be static. So when you (naturally) try to make the method static, you get the "cannot-hide-the-instance-method" error. (The Java Language Specification mentions this in section 9.4: "Note that a method declared in an interface must not be declared static, or a compile-time error occurs, because static methods cannot be abstract.")
So as long as the method is present in xInterface
, and your class implements xInterface
, you won t be able to make the method static.
If you can t change the interface (or don t want to), there are several things you can do:
- Make the class a singleton: make the constructor private, and have a static data member in the class to hold the only existing instance. This way you ll be invoking the method on an instance, but at least you won t be creating new instances each time you need to call the method.
- Implement 2 methods in your class: an instance method (as defined in
xInterface
), and a static method. The instance method will consist of a single line that delegates to the static method.