[
https://issues.apache.org/jira/browse/GROOVY-12667?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140112#comment-18140112
]
ASF GitHub Bot commented on GROOVY-12667:
-----------------------------------------
testlens-app[bot] commented on PR #3210:
URL: https://github.com/apache/groovy/pull/3210#issuecomment-6701684137
## 🚨 TestLens detected 4 failed tests 🚨
### Test Summary
> [!TIP]
> Inspect all details with the [TestLens
CLI](https://testlens.app/docs/features/cli): `testlens pr 3210`
#### [Build and test / lts \(21,
ubuntu-latest\)](https://github.com/apache/groovy/actions/runs/42332869594/job/128283125699?pr=3210)
> :test
| Test | Runs | Flakiness |
|---|---|--:|
| MemoizeAtLeastTest > testDehydrateClearsTheMemoizedClosure\(\) | ❌ |
0% 🟢 |
| MemoizeAtMostTest > testDehydrateClearsTheMemoizedClosure\(\) | ❌ |
0% 🟢 |
| MemoizeBetweenTest > testDehydrateClearsTheMemoizedClosure\(\) | ❌ |
0% 🟢 |
| MemoizeTest > testDehydrateClearsTheMemoizedClosure\(\) | ❌ | 0% 🟢 |
🏷️ Commit: 681b45dda5798a2c45fbacb99c80707c13f53dfa
▶️ Tests: 75140 executed
🟡 Checks: 9/25 completed
### Test Failures
<details><summary><strong>MemoizeAtLeastTest >
testDehydrateClearsTheMemoizedClosure()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42332869594/job/128283125699?pr=3210">Build
and test / lts (21, ubuntu-latest)</a>)</summary>
```
java.lang.AssertionError: Closure
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$_testDehydrateClearsTheMemoizedClosure_closure11@233db8e9
should have failed with an exception of type java.lang.NullPointerException,
but got: groovy.lang.MissingMethodException: No signature of method: foo for
class:
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$Named$_closure_closure1
is applicable for argument types: () values: []
Possible solutions: any(), find(), any(), find(), any(groovy.lang.Closure),
find(groovy.lang.Closure)
at groovy.test.GroovyAssert.fail(GroovyAssert.java:121)
at groovy.test.GroovyAssert.shouldFail(GroovyAssert.java:254)
at
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase.testDehydrateClearsTheMemoizedClosure(AbstractMemoizeTestCase.groovy:215)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
```
</details>
<details><summary><strong>MemoizeAtMostTest >
testDehydrateClearsTheMemoizedClosure()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42332869594/job/128283125699?pr=3210">Build
and test / lts (21, ubuntu-latest)</a>)</summary>
```
java.lang.AssertionError: Closure
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$_testDehydrateClearsTheMemoizedClosure_closure11@1200458e
should have failed with an exception of type java.lang.NullPointerException,
but got: groovy.lang.MissingMethodException: No signature of method: foo for
class:
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$Named$_closure_closure1
is applicable for argument types: () values: []
Possible solutions: any(), find(), any(), find(), any(groovy.lang.Closure),
find(groovy.lang.Closure)
at groovy.test.GroovyAssert.fail(GroovyAssert.java:121)
at groovy.test.GroovyAssert.shouldFail(GroovyAssert.java:254)
at
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase.testDehydrateClearsTheMemoizedClosure(AbstractMemoizeTestCase.groovy:215)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
```
</details>
<details><summary><strong>MemoizeBetweenTest >
testDehydrateClearsTheMemoizedClosure()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42332869594/job/128283125699?pr=3210">Build
and test / lts (21, ubuntu-latest)</a>)</summary>
```
java.lang.AssertionError: Closure
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$_testDehydrateClearsTheMemoizedClosure_closure11@9b76b60
should have failed with an exception of type java.lang.NullPointerException,
but got: groovy.lang.MissingMethodException: No signature of method: foo for
class:
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$Named$_closure_closure1
is applicable for argument types: () values: []
Possible solutions: any(), find(), any(), find(), any(groovy.lang.Closure),
find(groovy.lang.Closure)
at groovy.test.GroovyAssert.fail(GroovyAssert.java:121)
at groovy.test.GroovyAssert.shouldFail(GroovyAssert.java:254)
at
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase.testDehydrateClearsTheMemoizedClosure(AbstractMemoizeTestCase.groovy:215)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
```
</details>
<details><summary><strong>MemoizeTest >
testDehydrateClearsTheMemoizedClosure()</strong> (:test in <a
href="https://github.com/apache/groovy/actions/runs/42332869594/job/128283125699?pr=3210">Build
and test / lts (21, ubuntu-latest)</a>)</summary>
```
java.lang.AssertionError: Closure
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$_testDehydrateClearsTheMemoizedClosure_closure11@71a3e05c
should have failed with an exception of type java.lang.NullPointerException,
but got: groovy.lang.MissingMethodException: No signature of method: foo for
class:
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase$Named$_closure_closure1
is applicable for argument types: () values: []
Possible solutions: any(), find(), any(), find(), any(groovy.lang.Closure),
find(groovy.lang.Closure)
at groovy.test.GroovyAssert.fail(GroovyAssert.java:121)
at groovy.test.GroovyAssert.shouldFail(GroovyAssert.java:254)
at
org.codehaus.groovy.runtime.memoize.AbstractMemoizeTestCase.testDehydrateClearsTheMemoizedClosure(AbstractMemoizeTestCase.groovy:215)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
```
</details>
### Rerun Controls
> [!NOTE]
> Checks are currently running using the configuration below.
Select tests to mute in this pull request:
🔲 MemoizeAtLeastTest > testDehydrateClearsTheMemoizedClosure\(\) <!
> Implicit-this call in a DELEGATE_FIRST closure with a null delegate throws
> NullPointerException instead of calling the owner
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12667
> URL: https://issues.apache.org/jira/browse/GROOVY-12667
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 4.0.33, 5.0.8, 5.1.3, 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> class Owner {
> def foo() { 'owner' }
> def test() {
> def c = { -> foo() }
> c.resolveStrategy = Closure.DELEGATE_FIRST
> c.delegate = null
> c()
> }
> }
> assert new Owner().test() == 'owner'
> {code}
> *Actual:* {{java.lang.NullPointerException: Cannot invoke method foo() on
> null object}}. The same happens for OWNER_FIRST with a null owner (the
> delegate is never tried), for a dehydrated closure, and for a method that
> neither candidate has (NPE instead of MissingMethodException). Since
> GROOVY-11858, {{toString()}} in such a closure returns "null" and
> {{is(null)}} returns true, because they run against NullObject.
> *Expected:* a null delegate (or owner) is skipped and the other candidate
> answers, as in Groovy 3 and as property access ({{Closure.getProperty}})
> still does. When neither answers, a MissingMethodException is thrown.
> Cause: GROOVY-7232 removed the {{instanceof GroovyObject}} check from the
> DELEGATE_FIRST and OWNER_FIRST branches of {{ClosureMetaClass.invokeMethod}},
> which also let a null delegate or owner through to
> {{InvokerHelper.invokeMethod(null, ...)}}.
> Verified: 4.0.33, 5.0.8, 6.0.0 and master affected; 3.0.25 and 2.4.15 not
> affected.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)