You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/06/30 13:20:00 UTC
[jira] [Commented] (OFBIZ-11862) BigDecimal casting in Groovy
[ https://issues.apache.org/jira/browse/OFBIZ-11862?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17148666#comment-17148666 ]
ASF subversion and git services commented on OFBIZ-11862:
---------------------------------------------------------
Commit 466e426f8b35655d80ce45276218f3693c528a7c in ofbiz-framework's branch refs/heads/release18.12 from Jacques Le Roux
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=466e426 ]
Improved: BigDecimal casting in Groovy (OFBIZ-11862)
It's not a bug here, but casting is not necessary, better keep things simple
> BigDecimal casting in Groovy
> ----------------------------
>
> Key: OFBIZ-11862
> URL: https://issues.apache.org/jira/browse/OFBIZ-11862
> Project: OFBiz
> Issue Type: Bug
> Components: bi, order, product
> Affects Versions: Trunk
> Reporter: Jacques Le Roux
> Priority: Major
>
> [Pritam Kute noticed|https://issues.apache.org/jira/browse/OFBIZ-11843?focusedCommentId=17146911&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17146911] in OFBIZ-11843 that we sometimes use wrong type castings for BigDecimal:
> {quote}
> I have observed that for typecasting in groovy, we have used the wrong coding pattern like
> {code:java}
> (BigDecimal) -0.01
> {code}
> It should be like
> {code:java}
> -0.01 as BigDecimal
> {code}
> {quote}
> Actually in this case we don't need to cast, [because in case of decimal, the default type is always BigDecimal|https://www.logicbig.com/tutorials/misc/groovy/numbers-types-suffix.html].
> But there are Integers in trunk (mostly 0) and 2 cases where it's useless to cast in R18, nothing in R17
--
This message was sent by Atlassian Jira
(v8.3.4#803005)