aspose file tools*
The moose likes Java in General and the fly likes warnings going from 1.4.2 to 5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "warnings going from 1.4.2 to 5.0" Watch "warnings going from 1.4.2 to 5.0" New topic
Author

warnings going from 1.4.2 to 5.0

Thomas Paul Bigbee
Ranch Hand

Joined: Jun 28, 2005
Posts: 71
Greetings all

I've recently upgraded from 1.4.2 to 5.0 update 4 and have been stumbling across warnings and have to recompile with -source 1.4, below is a compilation of some of the problems that I'm having.



javac Test.java

Note: Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

javac -Xlint Test.java

When I recompile I get two warnings on line 4
Unchecked conversion
found : java.util.ArrayList
required: java.util.List<T>

unchecked method invocation:
<T> synchronizedList(java.util.List<T> ;)
in java.util.Collections is applied to applied to
(java.util.ArrayList)

on line 10
unchecked call to add(E) as a member of the raw type
java.util.Arraylist

Would someone please tell me where I'm going wrong?

Thanks, in advance

Tom

[ August 14, 2005: Message edited by: Thomas Paul Bigbee ]
[ August 14, 2005: Message edited by: Thomas Paul Bigbee ]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

You've done nothing wrong; all pre-Tiger Java code of any complexity will elicit these warnings when compiled with JDK 1.5. What's happened is that there is a new way to use the container classes. Here is a document that will introduce you to generics.

Note that you can't have it both ways! Code that won't give these warnings under Tiger, won't compile at all under older JDKs. This is an irreversible change once you start down that road.


[Jess in Action][AskingGoodQuestions]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
What do I see the following compiler warning?
Note: .java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

http://qa.jtiger.org/GetQAndA.action?qids=70&showAnswers=true


Tony Morris
Java Q&A (FAQ, Trivia)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: warnings going from 1.4.2 to 5.0