[
https://issues.apache.org/jira/browse/GROOVY-12663?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18140644#comment-18140644
]
ASF GitHub Bot commented on GROOVY-12663:
-----------------------------------------
testlens-app[bot] commented on PR #3184:
URL: https://github.com/apache/groovy/pull/3184#issuecomment-6719718832
## 🚨 Jobs failed without executing tests 🚨
### Failed Jobs without Test Failures
❌ [Generate SNAPSHOT artifacts /
dist](https://github.com/apache/groovy/actions/runs/42466429069/job/128686908023?pr=3184)
❌ [Generate SNAPSHOT distributions /
dist](https://github.com/apache/groovy/actions/runs/42466429056/job/128686907760?pr=3184)
🏷️ Commit: 4ce13f76821439d254e3735783f715cdd5b7678e
▶️ Tests: 0 executed
🟡 Checks: 5/24 completed
### Rerun Controls
Click the checkbox to trigger a rerun:
🔲 **Rerun jobs**
---
_Learn more about TestLens at
[testlens.app/docs](https://testlens.app/docs/features/pr-comment/)._
> @PackedClosures packs dynamic closures whose calls resolve against a closure
> object, calling the owner instead
> --------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12663
> URL: https://issues.apache.org/jira/browse/GROOVY-12663
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 6.0.0
> Reporter: Scott Murphy Heiberg
> Priority: Major
>
> {code:groovy}
> class C {
> String toString() { 'C' }
> @groovy.transform.PackedClosures Object m() { Closure outer = { -> { ->
> toString() }() }; [outer(), outer.toString()] }
> @groovy.transform.PackedClosures Object mem() { def c = { -> memoize() };
> c() }
> }
> println new C().m()
> new C().mem()
> {code}
> *Actual:* {{m()}} returns {{[C, C.$packed$closure$0@...]}} (the owner's
> toString, not the outer closure's), and {{mem()}} throws
> {{MissingMethodException: No signature of method: memoize for class: C}}. The
> same happens for:
> * other methods Closure declares: curry, dehydrate, rehydrate, asWritable,
> trampoline, rightShift, and recursion through call or doCall; clone() throws
> CloneNotSupportedException;
> * the properties maximumNumberOfParameters and parameterTypes, which throw
> MissingPropertyException;
> * hashCode, equals, getClass and GDK methods such as with or is in a nested
> closure.
> *Expected:* the same results as without the annotation. Methods that Closure
> declares resolve against the closure itself, and Object and GDK methods
> called in a nested closure resolve against the enclosing closure.
> Cause: in dynamic code the annotation is trusted, and the packing check only
> rejects the pseudo-property calls such as getDelegate(). The hoisted body is
> a method of the owner class, and a nested closure created in it gets the
> owner instance as its owner, so these calls reach the owner. The
> @CompileStatic counterpart is GROOVY-12660.
> Verified on 6.0.0 and master.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)