+ Start a Discussion
rm1rm1 

Api version 18 treats some Doubles as Decimals which breaks existing code

We have a class that we need to upgrade to api version 18.0 to be able to use the new AggregateResult object. Once we changed the version to 18.0, we got a bunch of 'Method does not exist or incorrect signature' errors.  The errors occurred both in the IDE and the UI.

 

We have a custom object that contains a number field named 'quantity'.  It has 2 decimal places.  The schema browser indicates that the field is a Double.  So we have a bunch of code similar to this that works fine prior to version 18: 

 

 

public void foo(){

MyCustomObject__c obj = [select id, quantity__c from MyCustomObject__c limit 1];

foo(obj.quantity__c);

}

public void foo(Double d){

// do something

}

 

After changing to version 18, we get the error 'Method does not exist or incorrect signature: foo(Decimal) '. Apparently, v18 treats 'quantity' as a Decimal instead of a Double. So we have to cast our field to a Double as follows: 

 

 

public void foo(){

MyCustomObject__c obj = [select id, quantity__c from MyCustomObject__c limit 1];

foo(Double.valueOf(obj.quantity__c));

}

 

1.) Is there any other solution for this?  Is there any documentation on this?

2.) Will the Spring 10 IDE schema browser indicate the correct data types - Decimal vs. Double?

Message Edited by rm1 on 03-05-2010 06:58 AM
Message Edited by rm1 on 03-05-2010 06:59 AM
mtbclimbermtbclimber

I'm not aware of an intentioal change in this regard, nor is it in our release notes. We're looking into it.

 

Thanks for bringing it to our attention. 

 

More to come.

 

 

rm1rm1
Any word on this?