16 Nov 2004 16:07
Re: Auto type conversion
This sounds like a bug. You shouldn't have to force coercion; I thought
this worked.
If in doubt you can cast
println max((int) 0, (int) qoh)
On 16 Nov 2004, at 15:03, Pascal DeMilly wrote:
> I am writing a small script that use the java.Math.max method. The
> problem I am having is that groovy insists on transforming my int to
> Integer. Since max doesn't have a prototype for (Integer, Integer)
> groovy issues an Exception. How can I force groovy to pass an (int,
> int)
> to max
>
> import java.Math.max;
>
> <snip>
>
> mydb.eachRow ("SELECT * from Items) {
> int qoh = it.QtyOnHand.intValue()
> print max(0, qoh) // Exception
> }
>
> TIA
>
> Pascal
>
>
James
-------
http://radio.weblogs.com/0112098/
RSS Feed