For Programmers: Free Programming Magazines  


Home > Archive > Java Help > October 2004 > warnings when compiling with jdk1.5









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author warnings when compiling with jdk1.5
Allan Bruce

2004-10-12, 3:59 pm

I have re-compliled some code with the new version of the JDK. I get the
following warning:

unchecked call to addElement(E) as a member of the raw type
java.util.Vector

Can somebody please tell me what this is and how to fix it?
Thanks
Allan



Elliott Back

2004-10-12, 3:59 pm

Allan Bruce wrote:
> I have re-compliled some code with the new version of the JDK. I get the
> following warning:
>
> unchecked call to addElement(E) as a member of the raw type
> java.util.Vector
>
> Can somebody please tell me what this is and how to fix it?
> Thanks
> Allan
>
>
>


I think that you should you use a generic type here. When you create
your vector, write:

Vector <Integer> v = new Vector();

This will allow the compiler to perform better automatic typechecking
and boxing / unboxing.

--
Thanks,
Elliott C. Bäck
---------------------------------
www.elliottback.com/blog/
www.spreadIE.com
Tor Iver Wilhelmsen

2004-10-13, 9:10 am

"Allan Bruce" <allanmb@TAKEAWAYf2s.com> writes:

> unchecked call to addElement(E) as a member of the raw type
> java.util.Vector
>
> Can somebody please tell me what this is and how to fix it?


It means the 1.5 runtime's collections API - which Vector is part of -
now uses generics. You can probably disable that warning using
"-Xlint:-unchecked" on the javac command line.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com