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

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

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

   ## 🚨 TestLens detected 2 failed tests 🚨
   
   ### Test Summary
   > [!TIP]
   > Inspect all details with the [TestLens 
CLI](https://testlens.app/docs/features/cli): `testlens pr 3024`
   
   #### [Build and test / lts \(17, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41151301556/job/124388210400?pr=3024)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface\(\) | ❌ | 0% 🟢 |
   
   #### [Build and test / lts \(25, 
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/41151301556/job/124388210157?pr=3024)
 > :test
   
   | Test | Runs | Flakiness |
   |---|---|--:|
   | MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface\(\) | ❌ | 0% 🟢 |
   
   🏷️ Commit: 239293bbe655f697156df67234b7a766416c9d65
   ▶️ Tests:  78837 executed
   🟡 Checks: 14/24 completed
   
   ### Test Failures
   
   <details><summary><strong>MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface()</strong> (:test in 
<a 
href="https://github.com/apache/groovy/actions/runs/41151301556/job/124388210400?pr=3024";>Build
 and test / lts (17, 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:1017)
        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>
   <details><summary><strong>MethodReferenceTest > 
testMethodReferencesInStaticAndDefaultMethodsOfInterface()</strong> (:test in 
<a 
href="https://github.com/apache/groovy/actions/runs/41151301556/job/124388210157?pr=3024";>Build
 and test / lts (25, 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:962)
        at 
java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:144)
        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\(\) <!

> Enum constants with literal arguments still select their constructor 
> reflectively through $INIT
> -----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12490
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12490
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Compiler
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> GROOVY-12240 made enum constants without arguments call the {{(String,int)}} 
> constructor directly. Every constant with arguments still goes through the 
> synthetic {{$INIT(Object[])}} helper, whose body is a spread {{this(*para)}}: 
> {{MetaClassImpl}} selects the constructor by reflecting over the declared 
> constructors. {{@CompileStatic}} does not change that, since {{$INIT}}'s own 
> body stays dynamic.
> As a result, an ordinary enum fails to initialize in a GraalVM native image 
> built without reflection metadata for it:
> {code:groovy}
> enum AccessModifier {
>     PRIVATE('private'), PROTECTED('protected'), PUBLIC('public')
>     final String keyword
>     AccessModifier(String keyword) { this.keyword = keyword }
> }
> {code}
> As written, the enum fails at the dynamic call to {{$INIT}} itself:
> {noformat}
> groovy.lang.MissingMethodException: No signature of static method: $INIT for 
> class: AccessModifier is applicable for argument types: (String, Integer, 
> String)
> {noformat}
> With {{@CompileStatic}} on the enum, {{$INIT}} is called with 
> {{invokestatic}}, and the constructor selection in its body fails instead:
> {noformat}
> groovy.lang.GroovyRuntimeException: Could not find matching constructor for: 
> AccessModifier(String, Integer, String)
> {noformat}
> Proposed fix: call the constructor directly when the compiler can prove what 
> the runtime would do: every argument is a literal, exactly one non-synthetic 
> constructor has the arity and none could take the arguments as varargs, and 
> each literal reaches its parameter unchanged ({{Boolean}} parameters 
> excluded). Everything else keeps {{$INIT}}, and the decision stays per enum, 
> as in GROOVY-12240.
> PR: https://github.com/apache/groovy/pull/3024



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

Reply via email to