[
https://issues.apache.org/jira/browse/GROOVY-11006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-11006.
----------------------------------
Fix Version/s: 3.0.20
Resolution: Fixed
https://github.com/apache/groovy/commit/d56990f04999a8495b0dde2f3bf1efa42886201b
> CompileStatic: cannot implicitly call double setter with BigDecimal literal
> ----------------------------------------------------------------------------
>
> Key: GROOVY-11006
> URL: https://issues.apache.org/jira/browse/GROOVY-11006
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 3.0.17
> Reporter: Jason Garrett
> Assignee: Eric Milles
> Priority: Minor
> Fix For: 3.0.20
>
>
> When a class declares a double property and setter for it:
> {code:java}
> class DoubleWithSetter {
> protected double myDouble
> void setMyDouble(double val) {
> this.myDouble = val
> }
> } {code}
> A statically-compiled subclass cannot "assign" a BigDecimal literal to that
> property:
> {code:java}
> import groovy.transform.CompileStatic
> @CompileStatic
> class BigDecimalImplicitDoubleSetter extends DoubleWithSetter {
> void doStuff() {
> double doubleVar = 0.0 // works
> myDouble = doubleVar // works
> myDouble = 0.0 // [Static type checking] - Cannot assign value
> of type java.math.BigDecimal to variable of type double
> }
> } {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)