This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Generics" Watch "Generics" New topic
Author

Generics

Set Lonnert
Greenhorn

Joined: Jan 15, 2005
Posts: 3
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

Joined: Jan 15, 2005
Posts: 3
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
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30076
    
149

Set,
Welcome to JavaRanch!

Are you compiling in 1.5 compatibility mode? What kind of compiler warnings do you get?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Set Lonnert
Greenhorn

Joined: Jan 15, 2005
Posts: 3
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generics
 
Similar Threads
Generics
confused with generics
generics
Generics
Generics