[ 
https://issues.apache.org/jira/browse/GROOVY-9999?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed 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))
> --------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-9999
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9999
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.5.11, 3.0.7, 4.0.0-alpha-2
>            Reporter: Andreas Vorgeitz
>            Priority: Critical
>             Fix For: 4.0.5
>
>         Attachments: TypeChecker.groovy
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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)}}
> {{}}}
> => [Static type checking] - Cannot find matching method 
> java.lang.Math#sqrt(java.math.BigDecimal). Please check if the declared type 
> is correct and if the method exists.
> in Groovy 2.4 this was valid code.
> I was able to write a TypeChecker, but it looks pretty ugly and i am not 
> shure, that this does not add other complications.
> Since most of my colleagues are not groovy mains, i prefer forcing the 
> TypeChecker, but this would lead to permanent castings from BigDecimal to 
> double before calling any method. 
> Any better workaround or a fix is appreciated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to