[
https://issues.apache.org/jira/browse/GROOVY-11223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Milles resolved GROOVY-11223.
----------------------------------
Fix Version/s: 3.0.22
Resolution: Fixed
https://github.com/apache/groovy/commit/f9b4eee804270242de22edc204feab2f9b900392
> STC: error message for inaccessible setter is not too helpful
> -------------------------------------------------------------
>
> Key: GROOVY-11223
> URL: https://issues.apache.org/jira/browse/GROOVY-11223
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
> Fix For: 3.0.22
>
>
> Consider the following:
> {code:groovy}
> class M extends HashMap<String,Number> {
> private void setFoo(foo) { print foo }
> }
> @groovy.transform.CompileStatic
> void test() {
> def map = new M()
> map.foo = 123
> print map.foo
> }
> {code}
> Assignment expression "map.foo = 123" shows error "[Static type checking] -
> Cannot assign value of type int to variable of type java.lang.Object".
> Adding cast to Object changes the message to "Cannot assign value of type
> java.lang.Object to variable of type java.lang.Object".
--
This message was sent by Atlassian Jira
(v8.20.10#820010)