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

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

testlens-app[bot] commented on PR #3279:
URL: https://github.com/apache/groovy/pull/3279#issuecomment-7074422453

   ## 🚨 TestLens detected 4 failed tests 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test for coverage / 
test](https://github.com/apache/groovy/actions/runs/44984485287/job/137091958653?pr=3279)
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3279`
   
   #### [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/44984485304/job/137091959159?pr=3279)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | TraitASTTransformationTest > <span 
title='testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()'>testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyComp…</span>
 | ❌ | 0%&nbsp;🟢 |
   | TraitMemberAccessMatrix > declaredInstanceProperty\(\) | ❌ | 0%&nbsp;🟢 |
   | TraitMemberAccessMatrix > declaredInstancePropertyRedeclaredByClass\(\) | 
❌ | 0%&nbsp;🟢 |
   | TraitMemberAccessMatrix > instanceAccessorOnlyProperty\(\) | ❌ | 0%&nbsp;🟢 
|
   
   🏷️ Commit: b16dfb3c3df6813b5012f5d74f5900d3703aca1b
   ▶️ Tests:  112287 executed
   🟡 Checks: 16/24 completed
   
   ### Test Failures
   
   <details><summary><strong>TraitASTTransformationTest > 
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()</strong>
 (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44984485304/job/137091959159?pr=3279";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
failed:
   Script2.groovy: -1: Cannot use package-private class T$4 from class T: T$4 
is defined by another class loader, so the JVM refuses this access. Use 
@CompileDynamic to reach it through the meta-class @ line -1, column 1.
   Script2.groovy: -1: Cannot use package-private class T$4 from class T: T$4 
is defined by another class loader, so the JVM refuses this access. Use 
@CompileDynamic to reach it through the meta-class @ line -1, column 1.
   Script2.groovy: -1: Cannot use package-private class T$4 from class T: T$4 
is defined by another class loader, so the JVM refuses this access. Use 
@CompileDynamic to reach it through the meta-class @ line -1, column 1.
   3 errors
   
        at 
org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:350)
        at 
org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:1198)
        at 
org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:818)
        at 
org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:771)
        at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:466)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:401)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:677)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:690)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:702)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:553)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:565)
        at 
org.codehaus.groovy.transform.traitx.TraitASTTransformationTest.testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer(TraitASTTransformationTest.groovy:3091)
   ```
   
   </details>
   <details><summary><strong>TraitMemberAccessMatrix > 
declaredInstanceProperty()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44984485304/job/137091959159?pr=3279";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   java.lang.AssertionError: lambda getLabel(), @CompileStatic: now follows the 
rule ('class'); remove it from the open cells. Expression: problems.empty
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:639)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.check(TraitMemberAccessMatrix.groovy:160)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.declaredInstanceProperty(TraitMemberAccessMatrix.groovy:80)
   ```
   
   </details>
   <details><summary><strong>TraitMemberAccessMatrix > 
declaredInstancePropertyRedeclaredByClass()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44984485304/job/137091959159?pr=3279";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   java.lang.AssertionError: lambda getLabel(), @CompileStatic: now follows the 
rule ('class'); remove it from the open cells. Expression: problems.empty
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:639)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.check(TraitMemberAccessMatrix.groovy:160)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.declaredInstancePropertyRedeclaredByClass(TraitMemberAccessMatrix.groovy:87)
   ```
   
   </details>
   <details><summary><strong>TraitMemberAccessMatrix > 
instanceAccessorOnlyProperty()</strong> (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44984485304/job/137091959159?pr=3279";>Build
 and test / lts (17, ubuntu-latest)</a>)</summary>
   
   ```
   java.lang.AssertionError: lambda getLabel(), @CompileStatic: now follows the 
rule ('class'); remove it from the open cells. Expression: problems.empty
        at 
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:639)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.check(TraitMemberAccessMatrix.groovy:160)
        at 
org.codehaus.groovy.transform.traitx.TraitMemberAccessMatrix.instanceAccessorOnlyProperty(TraitMemberAccessMatrix.groovy:73)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 TraitASTTransformationTest > 
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer\(\)
 <!

> 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)

Reply via email to