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

Eric Milles updated GROOVY-11369:
---------------------------------
    Description: 
Consider the following:
{code:groovy}
@TypeChecked test(Map map) {
  print map.empty
  print map.class
  print map.metaClass

  map.empty = null
  map.class = null
  map.metaClass = null

  print map
}
test([:])
{code}

When executed (without {{@TypeChecked}}) the script prints "null", "null", 
"null", "[emprt:null, class:null: metaClass: null]".  So these are all map 
entry read and writes.  However, STC indicates that "class" and "empty" are 
read-only properties.

  was:
Consider the following:
{code:groovy}
@TypeChecked test(Map map) {
  print map.empty
  print map.class
  print map.metaClass

  map.empty = null
  map.class = null
  map.metaClass = null

  print map
}
test([:])
{code}

When executed (without {{@TypeChecked}} the script prints "null", "null", 
"null", "[emprt:null, class:null: metaClass: null]".  So these are all map 
entry read and writes.  However, STC indicates that "class" and "empty" are 
read-only properties.


> STC: map properties "class" and "empty" indicated as read-only
> --------------------------------------------------------------
>
>                 Key: GROOVY-11369
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11369
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 3.0.21, 4.0.21
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>
> Consider the following:
> {code:groovy}
> @TypeChecked test(Map map) {
>   print map.empty
>   print map.class
>   print map.metaClass
>   map.empty = null
>   map.class = null
>   map.metaClass = null
>   print map
> }
> test([:])
> {code}
> When executed (without {{@TypeChecked}}) the script prints "null", "null", 
> "null", "[emprt:null, class:null: metaClass: null]".  So these are all map 
> entry read and writes.  However, STC indicates that "class" and "empty" are 
> read-only properties.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to