[
https://issues.apache.org/jira/browse/GROOVY-12744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140823#comment-18140823
]
ASF GitHub Bot commented on GROOVY-12744:
-----------------------------------------
codecov-commenter commented on PR #3279:
URL: https://github.com/apache/groovy/pull/3279#issuecomment-6725352999
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3279?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 74.4117%. Comparing base
([`0f525fe`](https://app.codecov.io/gh/apache/groovy/commit/0f525fea07baa89796b3e6fd5f565cb4e2d7f005?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`6bdc05d`](https://app.codecov.io/gh/apache/groovy/commit/6bdc05d42dc0a6decf0841ad022568b8da3fad62?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>
[](https://app.codecov.io/gh/apache/groovy/pull/3279?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3279 +/- ##
==================================================
- Coverage 74.4121% 74.4117% -0.0003%
- Complexity 44382 44395 +13
==================================================
Files 1699 1699
Lines 151079 151159 +80
Branches 28794 28799 +5
==================================================
+ Hits 112421 112480 +59
- Misses 28387 28395 +8
- Partials 10271 10284 +13
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3279?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...ain/java/org/codehaus/groovy/util/ListHashMap.java](https://app.codecov.io/gh/apache/groovy/pull/3279?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Futil%2FListHashMap.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3V0aWwvTGlzdEhhc2hNYXAuamF2YQ==)
| `89.1089% <100.0000%> (+1.0654%)` | :arrow_up: |
... and [14 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3279/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>
> Node metadata snapshots and copies miss changes made after the first one
> ------------------------------------------------------------------------
>
> Key: GROOVY-12744
> URL: https://issues.apache.org/jira/browse/GROOVY-12744
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> Since GROOVY-11966, {{NodeMetaDataHandler.newMetaDataMap()}} wraps a
> {{ListHashMap}} in {{Collections.synchronizedMap}}. The wrapper creates its
> {{entrySet()}} view on the first call and returns that same view afterwards.
> {{ListHashMap.entrySet()}} does not return a view backed by the map, as the
> {{Map}} contract requires: with up to three entries it returns the entries of
> a copy. So once a node's metadata has been read through {{getNodeMetaData()}}
> or copied with {{copyNodeMetaData}}, every later read or copy of that node
> returns the same old entries. Entries added since are missing, removed
> entries are still there, and replaced values keep their old value.
> {{keySet()}} and {{values()}} go stale in the same way.
> {code:groovy}
> import org.codehaus.groovy.ast.expr.ConstantExpression
> def a = new ConstantExpression(1)
> a.putNodeMetaData('k1', 1)
> println a.nodeMetaData // [k1:1]
> a.putNodeMetaData('k2', 2)
> println a.nodeMetaData // [k1:1], expected [k1:1, k2:2]
> def c = new ConstantExpression(3)
> c.copyNodeMetaData(a)
> println c.nodeMetaData // [k1:1], expected [k1:1, k2:2]
> a.removeNodeMetaData('k1')
> println a.nodeMetaData // [k1:1], expected [k2:2]
> {code}
> {{getNodeMetaData(key)}} is not affected, because it reads the map directly.
> Compilations run into this. In the core test suite, static compilation
> transforms of {{ConstructorCallExpression}} (map-style constructor calls) and
> {{PropertyExpression}} copy a stale {{DIRECT_METHOD_CALL_TARGET}}. In every
> case observed, the old and new values have the same signature, so no wrong
> bytecode was found. Any code that reads all of a node's metadata or copies it
> (AST transforms, tooling) can get old data.
> On 5.0.x and 4.0.x, {{getNodeMetaData()}} and {{copyNodeMetaData()}} read the
> {{ListHashMap}} directly, so each call sees the current entries. The
> {{ListHashMap}} views break the {{Map}} contract there too, though: if code
> keeps the map returned by {{getNodeMetaData()}} and reads it after the node
> changes, it gets the old entries.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)