• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

warnings going from 1.4.2 to 5.0

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
CAUTION! Do not touch the blades on your neck propeller while they are active. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic