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

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

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

   ## 🚨 TestLens detected 1 failed test 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [Build and test for coverage / 
test](https://github.com/apache/groovy/actions/runs/41153744990/job/124395860469?pr=3097)
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3097`
   
   #### [Build and test / lts \(21, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41153745027/job/124395861305?pr=3097)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface\(\) | ❌ | 0% 🟢 |
   
   🏷️ Commit: e9c86b5dfcd1263388525eff11f9a24d1aa8960c
   ▶️ Tests:  52483 executed
   🟡 Checks: 16/25 completed
   
   ### Test Failures
   
   <details><summary><strong>MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface()</strong> (:test in 
<a 
href="https://github.com/apache/groovy/actions/runs/41153745027/job/124395861305?pr=3097";>Build
 and test / lts (21, ubuntu-latest)</a>)</summary>
   
   ```
   java.lang.ClassFormatError: Method gstring$I$ctorRef$make$0$1 in class I has 
illegal modifiers: 0x101A
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
        at 
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at groovy.lang.GroovyClassLoader.access$000(GroovyClassLoader.java:90)
        at 
groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:1305)
        at groovy.lang.GroovyClassLoader.collect(GroovyClassLoader.java:284)
        at 
groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:440)
        at 
groovy.lang.GroovyClassLoader.lambda$parseClass$2(GroovyClassLoader.java:378)
        at 
org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:143)
        at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:378)
        at groovy.lang.GroovyShell.parseClass(GroovyShell.java:664)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:677)
        at groovy.lang.GroovyShell.parse(GroovyShell.java:689)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:551)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:587)
        at groovy.lang.GroovyShell.evaluate(GroovyShell.java:571)
        at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:107)
        at 
groovy.transform.stc.MethodReferenceTest.testMethodReferencesInStaticAndDefaultMethodsOfInterface(MethodReferenceTest.groovy:1613)
   ```
   
   </details>
   
   ### Rerun Controls
   > [!NOTE]
   > Checks are currently running using the configuration below.
   
   Select tests to mute in this pull request:
   
   🔲 MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface\(\) <!

> SC: protected and package-private members of a class defined by another 
> GroovyClassLoader compilation fail with IllegalAccessError
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12568
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12568
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> The JVM allows access to a protected or package-private member only within 
> the same run-time package, which is the package name and the class loader. A 
> {{GroovyClassLoader}} defines each compilation in memory with a class loader 
> of its own: a {{GroovyShell}} script, {{parseClass}}, a script run with 
> {{groovy}}, JSR-223. So a class of an earlier parse, or a precompiled class 
> used by such a script, is in another run-time package even with the same 
> package name. Statically compiled code calls such members directly and fails; 
> dynamic code goes through the meta-class and works.
> {code:groovy}
> def shell = new GroovyShell()
> shell.evaluate '''package p
>     class A {
>         @groovy.transform.PackageScope A(String s) { }
>         @groovy.transform.PackageScope String name() { 'a' }
>         @groovy.transform.PackageScope String tag = 't'
>     }
>     true
> '''
> shell.evaluate '''package p
>     @groovy.transform.CompileStatic
>     List make() { def a = new A('x'); [a.name(), a.tag] }
>     make()
> ''' // IllegalAccessError; without @CompileStatic: ['a', 't']
> {code}
> The same happens for map-style construction, instance and static methods, 
> getters and setters used as properties, method references such as 
> {{a::name}}, and field reads and writes including {{.@}}, {{+=}} and {{++}}. 
> In dynamic code, {{super.f}}, {{super.@f}} and {{this.@f}} of such a field, 
> and {{super.m()}} of such a method, fail the same way, because the {{super$}} 
> helper and the field instructions are generated directly.
> Related, in a subclass in another package, under static compilation:
> * {{new A(...)}} of a protected constructor of another package compiles and 
> then fails verification. As in Java, only {{super(...)}} and {{new A(...) 
> {}}} can call it.
> * a protected method of another package called through a receiver of the 
> superclass type ({{a.m()}}, {{a.name}}, {{a::m}}, {{A::m}}) compiles and then 
> fails with {{VerifyError}}: the GROOVY-7325 check compared the types the 
> wrong way round. {{a.@field = value}} through such a receiver fails 
> verification too.
> * with invokedynamic, a dynamic {{new ObjectInputStream()}} in a subclass 
> fails with {{GroovyBugError}} ("member is protected") instead of "could not 
> access constructor".
> Expected: such members are reached through the meta-class, as in dynamic 
> code; code compiled to class files (groovyc, Gradle, Maven, joint 
> compilation) keeps direct access, as javac does; the two verification 
> failures are compile errors.
> PR: https://github.com/apache/groovy/pull/3097



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

Reply via email to