I’d like to create a mock of this XQPart interface. The problem is that it extends an interface called XQCloneable which has a clone method.
When I in Eclipse create a new class with this set as an interface, I get this class:
public class Part implements XQPart {}
With a red error squiggly under Part saying
CloneNotSupportedException in throws clause of Object.clone() is not compatible with XQCloneable.clone()
What can I do here? Is there no way to make an implementation of this interface?
Note: I did try to implement the method, but didn’t realize I could skip the throws declaration as told in accepted answer so kept getting that error.
Your class inherits
Object.clone, which is declared to throwCloneNotSupportedException. On the other hand, your class implementsXQCloneable, whoseclonehas nothrowsclause. If you just create an empty declarationpublic Object clone() { return null; }, it will make your class compatible with the interface.