File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes warning: unchecked call to add(E) as a member of the raw type java.util.List Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "warning: unchecked call to add(E) as a member of the raw type java.util.List" Watch "warning: unchecked call to add(E) as a member of the raw type java.util.List" New topic
Author

warning: unchecked call to add(E) as a member of the raw type java.util.List

Gus Spier
Greenhorn

Joined: Dec 27, 2007
Posts: 5
MacBookPro OSX v 10.4.11
javac 1.5.0_13
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-241)
Java HotSpot(TM) Client VM (build 1.5.0_13-121, mixed mode, sharing)

google java.util.List to get the javadocs and look at java.util.List for java 2 Platform standard edition 5.0

find the entry for the "add" method and expect to see that it is deprecated and a recommendation for the new, accepted method of adding to an ArrayList ... but I don't see anything like a warning or deprecation notice.

What am I missing?

Regards,

Gus

PS: I am very appreciative of the time, trouble and patience you folk exhibit around here with your less experienced companeros. Thanks a lot.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

This message is because you are not using generics with your List. Note that this is only a warning -- not an error. Your code should still compile and run.

MacBookPro OSX v 10.4.11

Nice!


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Sandeep Nimmakuri
Greenhorn

Joined: Dec 20, 2010
Posts: 1
ArrayList<type of variable> list = new ArrayList<type of variable>()
this will fix it you need to mention which type of list it is
e.g

ArrayList<String> step = new ArrayList<String>()
step.add("abc");
step.add("cde");
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14110
    
  16

Sandeep, welcome to JavaRanch.

Please note that you are responding to a topic from 2007. The original poster is most likely not still waiting for an answer.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: warning: unchecked call to add(E) as a member of the raw type java.util.List