You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Alexey Panchenko <al...@olmisoft.com> on 2005/10/25 07:54:39 UTC

MathUtils patch

Hello,

This patch allows building on 1.5 with target=1.4

(in the current code it calls constructor "public BigDecimal(int val)"
which is @since 1.5)

Index: src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
===================================================================
--- src/java/org/apache/velocity/runtime/parser/node/MathUtils.java     (revision 328235)
+++ src/java/org/apache/velocity/runtime/parser/node/MathUtils.java     (working copy)
@@ -50,7 +50,7 @@
     /**
      * A BigDecimal representing the number 0
      */
-    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal ( 0 );
+    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal ( BigInteger.ZERO );
     protected static final BigInteger INT_ZERO        = BigInteger.valueOf( 0 );
 
     /**

-- 
Best regards,
 Alexey                          mailto:alex+news@olmisoft.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: Re[2]: MathUtils patch

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
"Henning P. Schmiedehausen" <hp...@intermeta.de> writes:

Please forget that mail. I didn't have had a second cup of coffee at
some point and my brain was still in emergency mode. :-)

I now see what you are referring to. You are correct. 

	Best regards
		Henning



>Alexey Panchenko <al...@olmisoft.com> writes:

>>Will Glass-Husain wrote:

>>> Did you actually have a compilation error?  This compiled fine with JDK 1.4
>>> in the past.  There's a constructor that takes a double.

>>When using java 1.4 to build 1.4 jar it works fine.

>>I want to use java 1.5 to build 1.4 jar, but get an error when class
>>is loaded by java 1.4, because 1.5 compiler (even with target=1.4)
>>calls "public BigDecimal(int val)", which is not available in 1.4.

>Hm. Strangely enough, there is no BigInteger(int val) C'tor in 1.5 either:

>BigInteger(byte[] val)
>BigInteger(int signum, byte[] magnitude)
>BigInteger(int bitLength, int certainty, Random rnd)
>BigInteger(int numBits, Random rnd)
>BigInteger(String val)
>BigInteger(String val, int radix)

>What JSDK are you using?

>	Best regards
>		Henning

>-- 
>Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
>hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

>RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
>   Linux, Java, perl, Solaris -- Consulting, Training, Development

>		      4 - 8 - 15 - 16 - 23 - 42

>---------------------------------------------------------------------
>To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: velocity-dev-help@jakarta.apache.org

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: Re[2]: MathUtils patch

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Alexey Panchenko <al...@olmisoft.com> writes:

>Will Glass-Husain wrote:

>> Did you actually have a compilation error?  This compiled fine with JDK 1.4
>> in the past.  There's a constructor that takes a double.

>When using java 1.4 to build 1.4 jar it works fine.

>I want to use java 1.5 to build 1.4 jar, but get an error when class
>is loaded by java 1.4, because 1.5 compiler (even with target=1.4)
>calls "public BigDecimal(int val)", which is not available in 1.4.

Hm. Strangely enough, there is no BigInteger(int val) C'tor in 1.5 either:

BigInteger(byte[] val)
BigInteger(int signum, byte[] magnitude)
BigInteger(int bitLength, int certainty, Random rnd)
BigInteger(int numBits, Random rnd)
BigInteger(String val)
BigInteger(String val, int radix)

What JSDK are you using?

	Best regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: Re[2]: MathUtils patch

Posted by Will Glass-Husain <wg...@forio.com>.
ok, thanks for the explanation. I'll apply the patch.

WILL

----- Original Message ----- 
From: "Alexey Panchenko" <al...@olmisoft.com>
To: "Velocity Developers List" <ve...@jakarta.apache.org>
Sent: Tuesday, October 25, 2005 10:26 PM
Subject: Re[2]: MathUtils patch


> Will Glass-Husain wrote:
>
>> Did you actually have a compilation error?  This compiled fine with JDK 
>> 1.4
>> in the past.  There's a constructor that takes a double.
>
> When using java 1.4 to build 1.4 jar it works fine.
>
> I want to use java 1.5 to build 1.4 jar, but get an error when class
> is loaded by java 1.4, because 1.5 compiler (even with target=1.4)
> calls "public BigDecimal(int val)", which is not available in 1.4.
>
>> ----- Original Message -----
>> From: "Alexey Panchenko" <al...@olmisoft.com>
>> To: "Velocity Developers List" <ve...@jakarta.apache.org>
>> Sent: Monday, October 24, 2005 10:54 PM
>> Subject: MathUtils patch
>
>
>>> Hello,
>>>
>>> This patch allows building on 1.5 with target=1.4
>>>
>>> (in the current code it calls constructor "public BigDecimal(int val)"
>>> which is @since 1.5)
>>>
>>> Index: src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
>>> ===================================================================
>>> --- src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
>>> (revision 328235)
>>> +++ src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
>>> (working copy)
>>> @@ -50,7 +50,7 @@
>>>     /**
>>>      * A BigDecimal representing the number 0
>>>      */
>>> -    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal
>>> ( 0 );
>>> +    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal
>>> ( BigInteger.ZERO );
>>>     protected static final BigInteger INT_ZERO        =
>>> BigInteger.valueOf( 0 );
>>>
>>>     /**
>>>
>>> -- 
>>> Best regards,
>>> Alexey                          mailto:alex+news@olmisoft.com
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>>>
>
>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>
>
>
>
> -- 
> Best regards,
> Alexey                            mailto:alex+news@olmisoft.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re[2]: MathUtils patch

Posted by Alexey Panchenko <al...@olmisoft.com>.
Will Glass-Husain wrote:

> Did you actually have a compilation error?  This compiled fine with JDK 1.4
> in the past.  There's a constructor that takes a double.

When using java 1.4 to build 1.4 jar it works fine.

I want to use java 1.5 to build 1.4 jar, but get an error when class
is loaded by java 1.4, because 1.5 compiler (even with target=1.4)
calls "public BigDecimal(int val)", which is not available in 1.4.

> ----- Original Message -----
> From: "Alexey Panchenko" <al...@olmisoft.com>
> To: "Velocity Developers List" <ve...@jakarta.apache.org>
> Sent: Monday, October 24, 2005 10:54 PM
> Subject: MathUtils patch


>> Hello,
>>
>> This patch allows building on 1.5 with target=1.4
>>
>> (in the current code it calls constructor "public BigDecimal(int val)"
>> which is @since 1.5)
>>
>> Index: src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
>> ===================================================================
>> --- src/java/org/apache/velocity/runtime/parser/node/MathUtils.java 
>> (revision 328235)
>> +++ src/java/org/apache/velocity/runtime/parser/node/MathUtils.java 
>> (working copy)
>> @@ -50,7 +50,7 @@
>>     /**
>>      * A BigDecimal representing the number 0
>>      */
>> -    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal 
>> ( 0 );
>> +    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal 
>> ( BigInteger.ZERO );
>>     protected static final BigInteger INT_ZERO        = 
>> BigInteger.valueOf( 0 );
>>
>>     /**
>>
>> -- 
>> Best regards,
>> Alexey                          mailto:alex+news@olmisoft.com
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>> 


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org




-- 
Best regards,
 Alexey                            mailto:alex+news@olmisoft.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Re: MathUtils patch

Posted by Will Glass-Husain <wg...@forio.com>.
Thanks for contributing this.

Did you actually have a compilation error?  This compiled fine with JDK 1.4 
in the past.  There's a constructor that takes a double.

WILL

----- Original Message ----- 
From: "Alexey Panchenko" <al...@olmisoft.com>
To: "Velocity Developers List" <ve...@jakarta.apache.org>
Sent: Monday, October 24, 2005 10:54 PM
Subject: MathUtils patch


> Hello,
>
> This patch allows building on 1.5 with target=1.4
>
> (in the current code it calls constructor "public BigDecimal(int val)"
> which is @since 1.5)
>
> Index: src/java/org/apache/velocity/runtime/parser/node/MathUtils.java
> ===================================================================
> --- src/java/org/apache/velocity/runtime/parser/node/MathUtils.java 
> (revision 328235)
> +++ src/java/org/apache/velocity/runtime/parser/node/MathUtils.java 
> (working copy)
> @@ -50,7 +50,7 @@
>     /**
>      * A BigDecimal representing the number 0
>      */
> -    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal 
> ( 0 );
> +    protected static final BigDecimal DECIMAL_ZERO    = new BigDecimal 
> ( BigInteger.ZERO );
>     protected static final BigInteger INT_ZERO        = 
> BigInteger.valueOf( 0 );
>
>     /**
>
> -- 
> Best regards,
> Alexey                          mailto:alex+news@olmisoft.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org