[
https://issues.apache.org/jira/browse/GROOVY-12361?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18111960#comment-18111960
]
ASF GitHub Bot commented on GROOVY-12361:
-----------------------------------------
testlens-app[bot] commented on PR #2882:
URL: https://github.com/apache/groovy/pull/2882#issuecomment-5555460146
## 🚨 TestLens detected 1 failed test 🚨
Here is what you can do:
1) Inspect the test failures carefully.
2) If you are convinced that some of the tests are flaky, you can mute them
below.
3) Finally, trigger a rerun by checking the rerun checkbox.
### Test Summary
#### [Build and test / lts \(17,
macos-latest\)](https://github.com/apache/groovy/actions/runs/33997644903/job/101390851666?pr=2882)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| ChannelSelectTest > testDataBeatsTheTimerAndTheTimerStillFires\(\) | ❌ |
8% 🟠 |
🏷️ Commit: 14df8237a520f1a8a377a6b529ae9f55cacc8f2a
▶️ Tests: 37552 executed
🟡 Checks: 6/29 completed
### Test Failures
<details><summary><strong>ChannelSelectTest >
testDataBeatsTheTimerAndTheTimerStillFires()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/33997644903/job/101390851666?pr=2882">Build
and test / lts (17, macos-latest)</a>)</summary>
```
Assertion failed:
assert result.index == 0 && result.value == 'done'
| | | |
| 1 | false
| false
SelectResult[channel=1, value=2026-09-05T23:18:46.872487Z]
at
org.codehaus.groovy.runtime.InvokerHelper.createAssertError(InvokerHelper.java:409)
at TestScript67.run(TestScript67.groovy:12)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:552)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:587)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:571)
at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:106)
at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:96)
at
groovy.concurrent.ChannelSelectTest.testDataBeatsTheTimerAndTheTimerStillFires(ChannelSelectTest.groovy:1135)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 ChannelSelectTest > testDataBeatsTheTimerAndTheTimerStillFires\(\) <!
> CachedMethod DirectInvoker: trampoline for a hidden declaring class throws
> NoClassDefFoundError on first invoke
> ---------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12361
> URL: https://issues.apache.org/jira/browse/GROOVY-12361
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
> The generated {{DirectInvoker}} trampoline from GROOVY-12325 names the target
> method's declaring class in its bytecode ({{CHECKCAST}} on the receiver,
> {{INVOKEVIRTUAL}}/{{INVOKEINTERFACE}} on the declaring type, or the
> {{invokeExact}} descriptor on the classData path). When that declaring class
> is a *hidden class* (JEP 371), the name is not resolvable by any class
> loader: the trampoline defines and initialises fine, but the first call
> through it fails with {{NoClassDefFoundError}}. The error escapes
> {{CachedMethod.invoke}} as-is because generation is sticky-successful and the
> failure only happens at invocation time.
> Groovy itself produces hidden declaring classes: {{ProxyGeneratorAdapter}}
> defines its proxies as hidden nestmates (GROOVY-12223) whenever the
> superclass is on the same loader as Groovy, so any map-as-abstract-class
> coercion of an application-classpath type is affected once the method has
> been invoked {{groovy.cachedmethod.invoker.threshold}} times (default 1000).
> h3. Reproducer
> Precompile so that {{Shape}} sits next to the Groovy jar on the application
> class path (a script compiled by {{GroovyClassLoader}} gets an ordinary,
> non-hidden proxy and does not reproduce):
> {code:groovy}
> abstract class Shape { abstract String name() }
> class ProxyRepro {
> static void main(String[] args) {
> def s = [name: { 'circle' }] as Shape
> println "hidden proxy: " + s.getClass().isHidden()
> // two cold call sites share the CachedMethod; its hit count reaches
> the
> // trampoline threshold while each indy site is still below its own
> 600.times { assert s.name() == 'circle' }
> 600.times { assert s.name() == 'circle' }
> println "ok"
> }
> }
> {code}
> {noformat}
> $ java -cp groovy-6.0.0-SNAPSHOT.jar
> org.codehaus.groovy.tools.FileSystemCompiler -d out ProxyRepro.groovy
> $ java -cp groovy-6.0.0-SNAPSHOT.jar:out ProxyRepro
> hidden proxy: true
> Exception in thread "main" java.lang.NoClassDefFoundError:
> Shape1_groovyProxy/0x0000007001120000
> at
> org.codehaus.groovy.reflection.CachedMethod.invokeGenerated(CachedMethod.java:491)
> at
> org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:452)
> at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:298)
> at
> org.codehaus.groovy.vmplugin.v8.IndyInterface.invokeColdReflective(IndyInterface.java:650)
> ...
> {noformat}
> A single call site masks the bug because the indy site promotes to the full
> method-handle chain at the same hit count (1000) and stops going through
> {{CachedMethod.invoke}}; two sites sharing the method, any MOP-path
> invocation ({{invokeMethod}}, categories, per-instance metaclass,
> {{@Delegate}} etc.), or {{-Dgroovy.cachedmethod.invoker.threshold=0}} exposes
> it. Setting either {{-Dgroovy.indy.cold.reflection=false}} or
> {{-Dgroovy.cachedmethod.invoker.disable=true}} avoids it. JDK 21, Groovy
> master (6.0.0-SNAPSHOT).
> h3. Fix
> {{InvokerFactory.tryCreate}} should decline (sticky null, so
> {{CachedMethod.invoke}} stays reflective) when the declaring class, the
> return type or any parameter type (array components included) {{isHidden()}}.
> All four define steps are affected, including Step 3 (classData), whose
> {{invokeExact}} descriptor also names the type.
> {{InvokerFactoryTest.testDefineStepsFallsThroughToClassDataForHiddenNonPublicHost}}
> currently asserts the opposite and even notes that the resulting trampoline
> must not be invoked; it needs to assert {{null}} instead. A fix with tests is
> available on branch {{groovy12354spike}} (the {{allTypesNameable}} gate).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)