You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Andreas Vorgeitz (Jira)" <ji...@apache.org> on 2021/03/24 09:06:00 UTC

[jira] [Created] (GROOVY-9999) @TypeChecked results in Error when groovy casts to BigDecimal ([Static type checking] - Cannot find matching method java.lang.Math#sqrt(java.math.BigDecimal))

Andreas Vorgeitz created GROOVY-9999:
----------------------------------------

             Summary: @TypeChecked results in Error when groovy casts to BigDecimal ([Static type checking] - Cannot find matching method java.lang.Math#sqrt(java.math.BigDecimal))
                 Key: GROOVY-9999
                 URL: https://issues.apache.org/jira/browse/GROOVY-9999
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 4.0.0-alpha-2, 3.0.7, 2.5.11
            Reporter: Andreas Vorgeitz
         Attachments: TypeChecker.groovy

From Groovy >2.4 simple calculations cannot be @TypeChecked without loads of casting:

{{import groovy.transform.TypeChecked}}

{{@TypeChecked}}
{{def test() {}}
{{   Math.sqrt(Math.PI*2)}}
{{}}}

I was able to write a TypeChecker, but it looks pretty ugly and i am not shure, that this does not add other complications.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)