[ 
https://issues.apache.org/jira/browse/GROOVY-8488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16384543#comment-16384543
 ] 

John Wagenleitner commented on GROOVY-8488:
-------------------------------------------

This is related to the change for GROOVY-8325 [commit 
d965023c266899|https://github.com/apache/groovy/commit/d965023c2668991e744c213c5125c5adcc677cd9].
 Looks like the change restricts the comparison of the primitive (number) types 
and their wrappers. Before the change it was valid to pass a {{BigDecimal}} or 
{{BigInteger}} (or even an {{AtomicLong}}) to a method taking a {{short}}.

In the test case provided the {{1.0}} is a {{BigDecimal}}, the method call 
works if {{1.0f}} is used.

> STC: floating-point literals no longer accepted as args to method with double 
> parameter
> ---------------------------------------------------------------------------------------
>
>                 Key: GROOVY-8488
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8488
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.4.13
>            Reporter: Eric Milles
>            Priority: Major
>
> I'm not sure if this recent change was intentional or not.  If it is 
> intended, so be it.  But in case this has not been seen by anyone else, we 
> had a lot of code that did floating-point computations and used 
> @CompileStatic.  Starting with Groovy 2.4.13 (I think), we are seeing STC 
> errors.
> {code:groovy}
> import groovy.transform.CompileStatic
> @CompileStatic
> class Static {
>   def main() {
>     meth(1.0) // STC error
>   }
>   def meth(double val) {
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to