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

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

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

   ## 🚨 Jobs failed without executing tests 🚨
   
   ### Failed Jobs without Test Failures
   
   ❌ [CodeQL / Analyze \(java, 
21\)](https://github.com/apache/groovy/actions/runs/42466429344/job/128686908693?pr=3173)
   ❌ [Generate SNAPSHOT artifacts / 
dist](https://github.com/apache/groovy/actions/runs/42466429543/job/128686909580?pr=3173)
   ❌ [Generate SNAPSHOT distributions / 
dist](https://github.com/apache/groovy/actions/runs/42466429452/job/128686909213?pr=3173)
   
   🏷️ Commit: 9309673a70694cabcd77aa841a379162e8fe988e
   ▶️ Tests:  0 executed
   🟡 Checks: 6/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/)._
   




> Closure packing ignores constructors and instance initializer blocks: 
> escaping closures are packed
> --------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12652
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12652
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> With closure packing enabled ({{-Dgroovy.target.closure.pack=true}} or 
> {{@PackedClosures}}), a closure literal in a constructor or an instance 
> initializer block bypasses the escape gate, the serialization gate and the 
> per-method packing mode:
> {code:groovy}
> class P { P(List<Closure> s) { s << { x -> x } } }
> class Q { Closure f; { f = { x -> x } } }
> def s = []; new P(s)
> [s[0].getClass().name, new Q().f.getClass().name]
> {code}
> *Actual* (dynamic, @TypeChecked and @CompileStatic): 
> {{[org.codehaus.groovy.runtime.PackedClosure$Fixed1, 
> org.codehaus.groovy.runtime.PackedClosure$Fixed1]}}. Under 
> {{@PackedClosures}}, setting a delegate on the escaped closure then throws 
> UnsupportedOperationException. {{@PackedClosures}} cannot be placed on a 
> constructor ("not allowed on element CONSTRUCTOR").
> *Expected:* {{[P$_closure1, Q$_closure1]}}, the same result as for a method: 
> escaping closures keep their class.
> Cause: {{WriterController.getMethodNode()}} is null while a constructor is 
> written, so the escape walk, the serialization walk and the annotation lookup 
> in ClosureWriter see no enclosing method. Instance initializer blocks are 
> inlined into constructors by the Verifier, so they are affected too.



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

Reply via email to