[ 
https://issues.apache.org/jira/browse/GROOVY-11223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric Milles updated GROOVY-11223:
---------------------------------
    Fix Version/s: 5.0.0-alpha-9

> 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
>    Affects Versions: 3.0.21
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.22, 5.0.0-alpha-9, 4.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)

Reply via email to