Menu
Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Overriding clone() in Java 5 (with generics)?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Ulrich Hobelmann, post: 1606746"] 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()). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Overriding clone() in Java 5 (with generics)?
Top