clone() methods that don't declare CloneNotSupportedException.
If CloneNotSupportedException is not declared, then subclasses will not be able to prohibit cloning
in the standard way. This inspection does not report clone() methods declared final
and clone() methods on final classes.
Use the checkbox below to indicate if this inspection should only warn on protected methods.
You can disable warnings for public methods if you are following the recommendation given in Effective Java, Second Edition> to omit
the exception declaration for public methods to make them easier to use.
Example
public class Example implements Cloneable {
protected Object clone() { // method doesn't have 'throw CloneNotSupportedException' clause, so inheritors can't throw it
try {
return super.clone();
}
catch(CloneNotSupportedException e){
return null;
}
}
}