How to implement interface with object.Clone conflicting method

interface, java, java-5, methods

Solution

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.

Problem

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.

Original source