• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • 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
Bartender
Posts: 3280
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Bartender
Posts: 3280
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done! And thanks for posting back your solution.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!