File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Unchecked Exception( -Xlint) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Unchecked Exception( -Xlint)" Watch "Unchecked Exception( -Xlint)" New topic
Author

Unchecked Exception( -Xlint)

Mansoor Khan
Greenhorn

Joined: Apr 14, 2008
Posts: 17


I'm getting the warning as: [unchecked] unchecked call to add(E) as a member of the raw type java.util.List

Kindly throw some light on this.

kingmansoor
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4490
    
    8

That's because List is a generic type, but you aren't using generics. If you change List to List<String> everywhere the warnings will go away. Remember they're only warnings...but you should always use the generic version (unless you have to work with legacy libraries that don't).
Mansoor Khan
Greenhorn

Joined: Apr 14, 2008
Posts: 17
Thank you Matthew.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19785
    
  20

This might be worth reading over.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unchecked Exception( -Xlint)