[ 
https://issues.apache.org/jira/browse/GROOVY-12024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18085005#comment-18085005
 ] 

ASF GitHub Bot commented on GROOVY-12024:
-----------------------------------------

codecov-commenter commented on PR #2580:
URL: https://github.com/apache/groovy/pull/2580#issuecomment-4587429972

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2580?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 68.1816%. Comparing base 
([`a3b47f2`](https://app.codecov.io/gh/apache/groovy/commit/a3b47f2b70c0236067ee20033b54b8a4c5c0c414?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`dc01f8c`](https://app.codecov.io/gh/apache/groovy/commit/dc01f8c48173b26b502909858699d13f5cba2f33?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 1 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/2580/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/2580?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #2580        +/-   ##
   ==================================================
   + Coverage     68.1808%   68.1816%   +0.0008%     
     Complexity      33164      33164                
   ==================================================
     Files            1511       1511                
     Lines          126232     126235         +3     
     Branches        22897      22897                
   ==================================================
   + Hits            86066      86069         +3     
   + Misses          32527      32526         -1     
   - Partials         7639       7640         +1     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/2580?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[.../codehaus/groovy/runtime/DefaultGroovyMethods.java](https://app.codecov.io/gh/apache/groovy/pull/2580?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fruntime%2FDefaultGroovyMethods.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3J1bnRpbWUvRGVmYXVsdEdyb292eU1ldGhvZHMuamF2YQ==)
 | `75.1044% <100.0000%> (+0.0208%)` | :arrow_up: |
   
   ... and [7 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/2580/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Subscript operator for Map has unexpected behavior when key is 'properties'
> ---------------------------------------------------------------------------
>
>                 Key: GROOVY-12024
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12024
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: David Costanzo
>            Assignee: Eric Milles
>            Priority: Minor
>
> The subscript operator has strange behavior for Map when the key is 
> 'properties'.  Instead of accessing the value associated with that key, it 
> accesses a read-only Map object.
> This behavior changed between Groovy 3 and Groovy 5.  My expectation is that 
> the subscript operator can access values for a key named 'properties', as it 
> did in Groovy 3.
> *Steps to Reproduce:*
> In groovysh 5, the subscript operator references the system-provided, 
> read-only map.
>  
> {code:java}
> groovy> map = ['properties': 1]
> groovy> map['properties']
> [:]
> groovy> map['properties'] = 2
> ReadOnlyPropertyException: Cannot set read-only property: properties for 
> class: java.util.LinkedHashMap{code}
>  
> In groovysh 3, the subscript operator references keys of the user-created map.
>  
> {code:java}
> groovy:000>  map = ['properties': 1]
> ===> [properties:1]
> groovy:000> map['properties']
> ===> 1
> groovy:000> map['properties'] = 2
> ===> 2{code}
>  
> I don't know if this is intentional, but I couldn't find a reference to in 
> the documentation.  On 
> [https://docs.groovy-lang.org/latest/html/documentation/#subscript-operator] 
> it says that the subscript operators is a shorthand for getAt() and setAt().  
> On 
> [https://docs.groovy-lang.org/latest/html/groovy-jdk/java/util/Map.html#getAt(java.lang.Object)]
>  it does not mention that "properties" can't be used as a key.
> In my view, this is either a code bug (an internal implementation detail is 
> being exposed beyond it's intended scope) or a doc bug (the subscript 
> operator or Map.getAt() should mention the reserved system key named 
> "properties").
> *Impact:*
> This creates the potential for hidden bugs.  For example, I have a script 
> that manages some metadata for internal libraries using a map keyed by the 
> library name.  The script  appears to work correctly, but then I add a 
> library named "properties" and the script fails to work.  (This is not 
> theoretical, this is what actually happened to me).
>  



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

Reply via email to