• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Generics and cloning

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

When I try to compile the following code, I get warnings about the unchecked cast used for the return type of the clone method. How do
I rectify this ?


Thanks
Devi

[ May 22, 2005: Message edited by: Sreedevi Vinod ]
[ May 22, 2005: Message edited by: Barry Gaunt ]
 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi how do I remove the smily from my post above ?
[ May 22, 2005: Message edited by: Sreedevi Vinod ]
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Smiley?

There's a disable smiley check box at the bottom of the form in which you enter your code. You may have to scroll down a bit though. Or you can add space between the offending characters.

Oh now I see it's because of the > and ) being close together.
I'll fix it.
[ May 22, 2005: Message edited by: Barry Gaunt ]
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The Cloneable interface is arguably the most broken (I can think of only one other candidate) part of the core J2SE API. It always has been. Since the introduction of JSR14, it is even more (but only slightly in comparison) broken. You can either:
a) put up with it and therefore, put up with its extreme shortcomings.
b) do it properly (it doesn't offer you much anyway).

Cloning an object itself (regardless of the broken API) requires an obscure case justification because it is almost certainly unnecessary. If you insist on cloning an object (for a justified reasoning or not), you can simply do something like (disclaimer: off the top of my head with no real thought):


(Edit: disabled smilies)
[ May 22, 2005: Message edited by: Tony Morris ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic