• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

"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
Posts: 3281
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
Posts: 3281
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's exactly the same and completely different as this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!