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

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

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

   ## 🚨 TestLens detected 1 failed test 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3252`
   
   #### [Build and test / lts \(21, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/44982248478/job/137085074992?pr=3252)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | TraitASTTransformationTest > <span 
title='testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()'>testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyComp…</span>
 | ❌ | 0%&nbsp;🟢 |
   
   🏷️ Commit: 18f487335c797d8eb4777009c311f956714d58fb
   ▶️ Tests:  121923 executed
   🟡 Checks: 14/24 completed
   
   ### Test Failures
   
   <details><summary><strong>TraitASTTransformationTest > 
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer()</strong>
 (:test in <a 
href="https://github.com/apache/groovy/actions/runs/44982248478/job/137085074992?pr=3252";>Build
 and test / lts (21, 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>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 TraitASTTransformationTest > 
testSuperTraitStaticAccessorAsPropertyInLambdaStaticallyCompiledByCustomizer\(\)
 <!

> super.f, super.@f and this.@f of a package-private field of a superclass of 
> another class loader fail with IllegalAccessError in dynamic code
> ---------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12718
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12718
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 4.0.32, 5.0.8, 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code:groovy}
> def shell = new GroovyShell()
> shell.evaluate '''package p
> class F { @groovy.transform.PackageScope String pf = 'pf' }
> true'''
> shell.evaluate '''package p
> class C extends F {
>     def test() {
>         assert pf == 'pf'       // works
>         assert this.pf == 'pf'  // works
>         super.pf                // IllegalAccessError, as are super.@pf, 
> this.@pf and writes through them
>     }
> }
> new C().test()'''
> {code}
> *Actual:* {{IllegalAccessError: class p.C tried to access field p.F.pf}}.
> *Expected:* the value of the field, through the meta-class, as for {{pf}} and 
> {{this.pf}}.
> Cause: {{F}} comes from an earlier parse, so it has the same package name as 
> {{C}} but another class loader, which makes it another run-time package. 
> {{AsmClassGenerator.visitPropertyExpression}} and 
> {{visitAttributeExpression}} decide by the package name and write 
> {{GETFIELD}} or {{PUTFIELD}}, in dynamic and {{@TypeChecked}} code too.
> Verified on 4.0.32, 5.0.8, 6.0.0 and master.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to