• 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

"Recompile with -Xlint:unchecked for details message" appear when run Ant project

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

When I run build.xml I got below error message. Anyone can help on this? Thanks in advance.
Buildfile: D:\eclipse\workspace\testAnt\build.xml
compile:
[echo] compile the project
[javac] Compiling 13 source files to D:\classes
[javac] D:\eclipse\workspace\BmiJava\reng\report\statement\SctnSVISalesOpptyDetails.java:193: compareTo(java.math.BigDecimal) in java.math.BigDecimal cannot be applied to (java.lang.Object)
[javac] BIG_DECIMAL_ZERO.compareTo(endUserEntitledPrice) == 0)
[javac] ^
[javac] D:\eclipse\workspace\BmiJava\reng\report\statement\SctnSVISalesOpptyDetails.java:249: compareTo(java.math.BigDecimal) in java.math.BigDecimal cannot be applied to (java.lang.Object)
[javac] BIG_DECIMAL_ZERO.compareTo(endUserEntitledPrice) == 0)
[javac] ^
[javac] Note: D:\eclipse\workspace\BmiJava\fwf\WfBlock.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 2 errors

BUILD FAILED
D:\eclipse\workspace\testAnt\build.xml:22: Compile failed; see the compiler error output for details.

Total time: 1 second

 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're getting a standard Java compile error:

compareTo(java.math.BigDecimal) in java.math.BigDecimal cannot be applied to (java.lang.Object), I'm guessing BIG_DECIMAL_ZERO is declared as an Object, it needs to be a BigDecimal.
 
Haifeng Jiang
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:You're getting a standard Java compile error:

compareTo(java.math.BigDecimal) in java.math.BigDecimal cannot be applied to (java.lang.Object), I'm guessing BIG_DECIMAL_ZERO is declared as an Object, it needs to be a BigDecimal.


But when I use eclipse, the project can be compiled successfully. And I checked I used the same version 1.6 Jdk to compile the project.

My build.xml file as below:


Does that error relate to the jdk version? Or ant will use there own jdk to compile the project? Can help me on this? Thanks.
 
Haifeng Jiang
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the answer just now. The cause is compareTo method doesn't allow Object as the type of parameter. Now I forcibly convert it to BigDecimal. Now it works fine. Thanks so much!

BIG_DECIMAL_ZERO.compareTo((BigDecimal)endUserEntitledPrice) == 0)
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done! And thanks for posting back your solution.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic