[
https://issues.apache.org/jira/browse/GROOVY-12552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140470#comment-18140470
]
ASF GitHub Bot commented on GROOVY-12552:
-----------------------------------------
testlens-app[bot] commented on PR #3081:
URL: https://github.com/apache/groovy/pull/3081#issuecomment-6716161261
## 🚨 TestLens detected 1 failed test 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3081`
#### [Build and test / lts \(21,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42437351746/job/128598949919?pr=3081)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| ParallelCollectionTest > testEachParallelRunsConcurrently\(\) | ❌ |
1% 🟡 |
🏷️ Commit: a42780a5d60f981af4c62ef53099cfbca3515c4e
▶️ Tests: 46200 executed
🟡 Checks: 7/24 completed
### Test Failures
<details><summary><strong>ParallelCollectionTest >
testEachParallelRunsConcurrently()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42437351746/job/128598949919?pr=3081">Build
and test / lts (21, ubuntu-latest)</a>)</summary>
```
java.lang.reflect.UndeclaredThrowableException
at
java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at
java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:540)
at
java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:567)
at
java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:653)
at
org.codehaus.groovy.runtime.ParallelCollectionExtensions.lambda$eachParallel$1(ParallelCollectionExtensions.java:118)
at
org.codehaus.groovy.runtime.ParallelCollectionExtensions.withPool(ParallelCollectionExtensions.java:405)
at
org.codehaus.groovy.runtime.ParallelCollectionExtensions.eachParallel(ParallelCollectionExtensions.java:117)
at TestScript109$_run_closure1$_closure2.doCall(TestScript109.groovy:19)
at groovy.lang.Closure.invokeHandle(Closure.java:650)
at groovy.lang.Closure.invokeCached(Closure.java:621)
at groovy.lang.Closure.call(Closure.java:587)
at groovy.lang.Closure.call(Closure.java:546)
at
org.codehaus.groovy.runtime.DefaultGroovyMethods.times(DefaultGroovyMethods.java:17397)
at TestScript109$_run_closure1.doCall(TestScript109.groovy:15)
at groovy.lang.Closure.invokeHandle(Closure.java:650)
at groovy.lang.Closure.invokeCached(Closure.java:621)
at groovy.lang.Closure.call(Closure.java:587)
at
org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:55)
at
org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:130)
at jdk.proxy2/jdk.proxy2.$Proxy53.apply(Unknown Source)
at groovy.concurrent.AsyncScope.lambda$withScope$0(AsyncScope.java:167)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.lambda$call$0(ScopedLocal.java:320)
at
org.apache.groovy.runtime.async.ScopedLocal$ThreadLocalImpl.bind(ScopedLocal.java:428)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.lambda$execute$1(ScopedLocal.java:338)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.execute(ScopedLocal.java:340)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.call(ScopedLocal.java:320)
at
org.apache.groovy.runtime.async.ScopedLocal.where(ScopedLocal.java:220)
at
org.apache.groovy.runtime.async.DefaultAsyncScope.withCurrent(DefaultAsyncScope.java:99)
at groovy.concurrent.AsyncScope.withCurrent(AsyncScope.java:121)
at groovy.concurrent.AsyncScope.withScope(AsyncScope.java:167)
at
groovy.concurrent.ParallelScope.lambda$withPool$1(ParallelScope.java:92)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.lambda$call$0(ScopedLocal.java:320)
at
org.apache.groovy.runtime.async.ScopedLocal$ThreadLocalImpl.bind(ScopedLocal.java:428)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.lambda$execute$1(ScopedLocal.java:338)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.execute(ScopedLocal.java:340)
at
org.apache.groovy.runtime.async.ScopedLocal$Carrier.call(ScopedLocal.java:320)
at
org.apache.groovy.runtime.async.ScopedLocal.where(ScopedLocal.java:220)
at
org.apache.groovy.runtime.async.DefaultPool.withCurrent(DefaultPool.java:262)
at groovy.concurrent.Pool.withCurrent(Pool.java:152)
at groovy.concurrent.ParallelScope.withPool(ParallelScope.java:92)
at TestScript109.run(TestScript109.groovy:13)
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:107)
at groovy.test.GroovyAssert.assertScript(GroovyAssert.java:97)
at
groovy.concurrent.ParallelCollectionTest.testEachParallelRunsConcurrently(ParallelCollectionTest.groovy:48)
Caused by: java.lang.reflect.UndeclaredThrowableException
at
java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
at
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
at
java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:540)
at
java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:567)
at
java.base/java.util.concurrent.ForkJoinTask.invoke(ForkJoinTask.java:670)
at
java.base/java.util.stream.ForEachOps$ForEachOp.evaluateParallel(ForEachOps.java:160)
at
java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateParallel(ForEachOps.java:174)
at
java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:233)
at
java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at
java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:765)
at
org.codehaus.groovy.runtime.ParallelCollectionExtensions.lambda$eachParallel$0(ParallelCollectionExtensions.java:118)
at
java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1403)
at
java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at
java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at
java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at
java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at
java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)
Caused by: java.lang.reflect.UndeclaredThrowableException
at jdk.proxy2/jdk.proxy2.$Proxy61.accept(Unknown Source)
at
java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at
java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
at
java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at
java.base/java.util.stream.ForEachOps$ForEachTask.compute(ForEachOps.java:291)
at
java.base/java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:754)
... 5 more
Caused by: java.util.concurrent.TimeoutException
at
java.base/java.util.concurrent.CyclicBarrier.dowait(CyclicBarrier.java:259)
at
java.base/java.util.concurrent.CyclicBarrier.await(CyclicBarrier.java:437)
at
TestScript109$_run_closure1$_closure2$_closure3.doCall(TestScript109.groovy:21)
at groovy.lang.Closure.invokeHandle(Closure.java:650)
at groovy.lang.Closure.invokeCached(Closure.java:621)
at groovy.lang.Closure.call(Closure.java:587)
at
org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:55)
at
org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:130)
... 11 more
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 ParallelCollectionTest > testEachParallelRunsConcurrently\(\) <!
> STC: property access calls an interface's accessor instead of the property's
> own when the property's class is in the same compilation unit
> ------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12552
> URL: https://issues.apache.org/jira/browse/GROOVY-12552
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 5.1.3
> Reporter: James Daugherty
> Priority: Major
>
> When an interface declares the setter and getter of a property that a class
> implements as a Groovy property, static compilation calls the interface's
> methods with {{invokeinterface}} when the class is compiled together with the
> caller, and the class's own accessors with {{invokevirtual}} when the class
> is already compiled. The behaviour at run time is the same, but the same
> source compiles to a different class file depending on what else is compiled.
> Groovy 4.0.33 calls the class's accessors in both cases.
> {code:groovy}
> interface Named {
> void setName(String name)
> String getName()
> }
> abstract class Base implements Named {
> String name
> }
> class Impl extends Base {}
> @groovy.transform.CompileStatic
> class Svc {
> String rename() {
> Base base = new Impl()
> base.name = 'x' // invokeinterface Named.setName when Base is in
> the unit, invokevirtual Impl.setName when it is compiled
> base.setName('y')
> base.getName()
> }
> }
> {code}
> Reproduced with 5.1.3 and master. A reproducer with a groovyc script and an
> incremental Gradle build:
> https://github.com/jdaugherty/groovy-property-accessor-interface-method
> *Cause*
> A property of a class in the compilation unit does not have its accessors yet
> when static type checking runs. {{StaticTypeCheckingVisitor.findMethod}} adds
> a synthetic accessor for the property when every method found is abstract
> (GROOVY-10922), but after the interface's method.
> {{StaticTypeCheckingSupport.removeCovariantsAndInterfaceEquivalents}} only
> drops an interface method that comes after the method of a class implementing
> it, so both stay. The receiver-distance tie-break in {{chooseBestMethods}}
> then ranks an interface implemented by the superclass at 1 and the superclass
> itself at 4, so the interface method is chosen whenever the receiver's
> inferred type is a subclass of the property's class ({{Impl}} here); with the
> receiver exactly {{Base}} the accessor is chosen already. A compiled class
> lists its real accessor first, and the interface method is dropped.
> *Proposed fix*
> Add the synthetic accessor first, where a compiled class has its accessor, so
> that it is preferred over the interface method the same way.
> Found while making incremental builds of a Grails application produce the
> same classes as a full build; see also GROOVY-12550 and GROOVY-12544.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)