Skip to content

Tag Archives: java

cloning woes

The implementation of Object.clone() prevents guaranteed type-safe (both compile- and runtime) code from compiling. The following class will not compile:

public class SafeCloner {

public Object cloneOrNull(Cloneable in) { try { return in.clone(); [...]