You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Stephen Albrecht (Jira)" <ji...@apache.org> on 2025/09/23 18:58:00 UTC
[jira] [Created] (GROOVY-11760) @CompileStatic method triggers static type checking error in Groovy 5 but not Groovy 4
Stephen Albrecht created GROOVY-11760:
-----------------------------------------
Summary: @CompileStatic method triggers static type checking error in Groovy 5 but not Groovy 4
Key: GROOVY-11760
URL: https://issues.apache.org/jira/browse/GROOVY-11760
Project: Groovy
Issue Type: Bug
Components: Static compilation
Affects Versions: 5.0.1
Reporter: Stephen Albrecht
This script executes in Groovy 4.0.28 but fails in 5.0.1
{code:java}
import groovy.transform.CompileStatic
@CompileStatic
float getFoo() { 1f / 1 }
foo{code}
Groovy 4.0.28
{code:java}
Result: 1.0{code}
Groovy 5.0.1
{code:java}
[Static type checking] - Possible loss of precision from double to float
at line: 5, column: 4{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)