• 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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Having trouble with comprehending generics, especially the wildcard addition. Perhaps there is someone here which could tell me about how to circumvent the oddities of type conversion in the following ...

What am I thinking wrong?

(Ok, I've studied a bit about GJ, Pizza, NextGen etc. but still ... doesn't get things right, yet.)



Regards!
/Set Lonnert
 
Set Lonnert
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sorry if my posting is somewhat cryptic? In any way, I should perhaps be more verbose? In the code followup, kind of:



my problem is the lack of type casting give compiler warnings, warnings which I have really no idea how to handle? Casting down to what becomes raw types give me a, kind of, headache. Or at least the compiler thins so. Could anyone give me an idea on how to handle casts (with-) in type parameters correctly, that will not give unsafe type conversions? Any short sample will do, not necessarily referring to the above. (My prevois experience derives from logic, but here the logic seems to be only erasure compatible with ordinary Java. Hm.)

Regards!
/Set Lonnert
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Set,
Welcome to JavaRanch!

Are you compiling in 1.5 compatibility mode? What kind of compiler warnings do you get?
 
Set Lonnert
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for having me

Yes I compile using the 1.5 or whatever version numbering they use these days. These are approx. the warnings I get:


Should there be wrappers to avoid implicit conversions to raw types (most frequent
warning), or should there perhaps be a wildcard somewhere (as mentioned, I don't yet
understand its significance)? Any ideas are most welcome ...

Regards!
/Set Lonnert
PS. I was here years ago, but then there were to few to mention
.. no talk to I mean
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic