File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

warnings going from 1.4.2 to 5.0

 
Thomas Paul Bigbee
Ranch Hand
Posts: 71
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tony Morris
Ranch Hand
Posts: 1608
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic