You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Jacques Le Roux (Jira)" <ji...@apache.org> on 2020/06/30 13:06:00 UTC

[jira] [Created] (OFBIZ-11862) BigDecimal casting in Groovy

Jacques Le Roux created OFBIZ-11862:
---------------------------------------

             Summary: 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


[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)