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 throw CloneNotSupportedException
. On the other hand, your class implements XQCloneable
, whose clone
has no throws
clause. If you just create an empty declaration public Object clone() { return null; }
, it will make your class compatible with the interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With