class Asdf<T extends Cloneable> implements Cloneable {
public T t;
protected Object clone() throws CloneNotSupportedException {
...
t.clone(); // The method is not visible
...
}
}
You can't clone that object of generic class T. The Cloneable interface does not
guarantee that you can clone an object that implements that interface (also read
the API documentation for that interface).
You can either try to use reflection and find the clone() method (very ugly) or
create your own interface:
Code:
public interface MyCloneable extends Cloneable {
public Object clone();
}
Comment