logo       

Re: Auto type conversion: msg#00076

lang.groovy.user

Subject: Re: Auto type conversion

James,

I had tried that and got the same result. I am currently using beta-6
and haven't tested it with beta-7. Maybe it has been fixed. For now, I
wrote my own max function.

Thanks for your help

Pascal

On Tue, 2004-11-16 at 07:07, jastrachan-ee4meeAH724@xxxxxxxxxxxxxxxx wrote:
> 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/
>




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise