Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Haifeng Jiang
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

 
Martijn Verburg
author
Bartender
Posts: 3275
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: 3275
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic