Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Debian GNU/Linux Testing; Java 1.5.0_05; Groovy CVS 2005-11-16 14:47
-
Patch
Description
The statement:
BigInteger i = new BigInteger ( "20" )
works fine
BigInteger i = new BigInteger ( 20 )
fails with the message:
Caught: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: java.math.BigInteger(java.lang.Integer)
since although there is a BigInteger ( int ) constructor there is no BigInteger ( Integer ) constructor and literals are Integer by default in Groovy. In fact, there seems no way of using an integer literal parameter as:
BigInteger i = new BigInteger ( 20 as int )
fails since the 20 as int appears to do nothing.
It would be useful if
BigInteger i = 20
worked but currently this fails with:
Caught: java.lang.ClassCastException: java.lang.Integer
as there is no cast route from Integer to BigInteger.