You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2018/08/26 01:52:00 UTC
[jira] [Comment Edited] (GROOVY-8488) STC: floating-point literals
no longer accepted as args to method with double parameter
[ https://issues.apache.org/jira/browse/GROOVY-8488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16592743#comment-16592743 ]
Daniel Sun edited comment on GROOVY-8488 at 8/26/18 1:51 AM:
-------------------------------------------------------------
It is better to convert type automatically IMO. The issue is a bit similar to GROOVY-6668.
To [~paulk] [~jwagenleitner] We should discuss "Least Surprise VS Strict Type Check" seriously in mailing list.
{code:java}
import groovy.transform.CompileStatic
@CompileStatic
class Static {
def main() {
meth(1.0d) // works
}
def meth(double val) {
}
}
{code}
was (Author: daniel_sun):
It is better to convert type automatically IMO. The issue is a bit similar to GROOVY-6668.
To [~paulk] [~jwagenleitner] We should discuss "Least Surprise VS Strict Type Check" seriously in mailing list.
{code:java}
import groovy.transform.CompileStatic
@CompileStatic
class Static {
def main() {
meth(1.0d)
}
def meth(double val) {
}
}
{code}
> 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)