U
Ulrich Hobelmann
Hi, is there any way I can have a typesafe clone() in Java 5?
I have a subclass of LinkedList<T>, but calling clone() causes warnings,
and typecasting to (MyList<T>) doesn't work either.
I overrode public MyList<T> clone() in my list class, but calling
super.clone() again caused the same problem, so there's no way out
How do you make clone() typesafe (or typesafely call it), and compile
without complaints? As I only made some minor modifications to
LinkedList, I basically refuse to write my own clone() (say, with addAll()).
I have a subclass of LinkedList<T>, but calling clone() causes warnings,
and typecasting to (MyList<T>) doesn't work either.
I overrode public MyList<T> clone() in my list class, but calling
super.clone() again caused the same problem, so there's no way out
How do you make clone() typesafe (or typesafely call it), and compile
without complaints? As I only made some minor modifications to
LinkedList, I basically refuse to write my own clone() (say, with addAll()).