示例
public class
ClassA
implements
Cloneable
{{
public
Object clone
throws
CloneNotSupportedException () {
//...
}
}
解决方案
始终将 clone 方法声明为
final
。
public class
ClassA
implements
Cloneable
{{
public final
Object clone
throws
CloneNotSupportedException () {
//...
}
}