I'm going through some old code and found the following:
public class MyClass implements Cloneable {
public Object clone() {
Object o = null;
try {
o = super.clone();
} catch (CloneNotSupportedException ex) {
}
return o;
}
}
I've read the javadocs on Object.clone(), and I'm trying to figure out why this catch is even there. I mean, I understand it has to be there because Object.clone() throws it, but when would it ever get there, if I'm only extending Object by default, and this class is implmenting Cloneable? If this class was extended and the sub-class didn't implement Cloneable, is that what it's there for?
So is it OK to leave that catch block empty?