This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Warning : Compiling code with JDK1.6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Warning : Compiling code with JDK1.6" Watch "Warning : Compiling code with JDK1.6" New topic
Author

Warning : Compiling code with JDK1.6

Rizwan Patel
Ranch Hand

Joined: Jan 03, 2008
Posts: 59
Hi All,

I am facing below problem while compiling the source code.


I had the code which is written and compiled using the JDK1.4 now as I want to update that to JDK 1.6 i am facing the above problem at various places.
As it is a warning displayed everytime, i want to know whether there is any way around apart from changing the code.

Please help!


scjp 1.5, OCPJWSD 5
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

My hint



Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24166
    
  30

If you want to update the code, then you need to add the casts; that's part of what updating the code would mean!

If you just want the warnings to go away, you could compile in JDK 1.4 compatibility mode

javac -source 1.4 -target 1.4 Foo.java


[Jess in Action][AskingGoodQuestions]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19538
    
  16

Originally posted by Ernest Friedman-Hill:
If you want to update the code, then you need to add the casts; that's part of what updating the code would mean!

Or, in this case, remove the null from invoke:

Because varargs allow you to pass zero elements, which will be treated as an array of size zero.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Warning : Compiling code with JDK1.6
 
Similar Threads
JDK 1.5 warnings during build
Arrays.asList(...) problem
Strange 'var arg' method.
Overloading with varargs and array parameters, strange inconsistency?
xerces.jar error when migrating from weblogic 8.1SP6 to Oracle Weblogic 10.