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

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

codeconsole opened a new pull request, #3178:
URL: https://github.com/apache/groovy/pull/3178

   
`MethodReferenceTest$NativeMethodReferenceBytecodeTest.testPrivateConstructorOfNestedClassIsCalledDirectlyFromClosureOrLambda`
 fails when the tests run with `-Pgroovy.target.closure.pack=true`, with 
`method ctorRef$doCall$0 not found`. The test inspects the generated classes 
`C$_inClosure_closure1` and `C$_inLambda_lambda2` by name. With packing on, the 
closure is hoisted into `C` and the lambda class is renamed to 
`C$_inLambda_lambda1`. The packed code is correct; only the class names the 
test expects are gone.
   
   The test's class `C` is now annotated with `@PackedClosures(mode = 
PackMode.DISABLED)`. The test checks the method-reference helper inside a 
closure class and a lambda class, and the annotation keeps that shape whether 
or not the flag is set.
   
   The other tests in `groovy.transform.stc.*` and 
`org.codehaus.groovy.classgen.asm.sc.*` that fail only with the flag are 
behaviour differences with their own issues (#3175 and two more to follow).
   
   ## Tests
   
   `MethodReferenceTest*` fails with the flag before this change (1 of 165) and 
passes with and without the flag after it. The Checkstyle and CodeNarc gates 
pass.
   




> MethodReferenceTest bytecode test fails with groovy.target.closure.pack=true
> ----------------------------------------------------------------------------
>
>                 Key: GROOVY-12657
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12657
>             Project: Groovy
>          Issue Type: Test
>    Affects Versions: 7.0.0-alpha-1
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> {code}
> ./gradlew :test -Pgroovy.target.closure.pack=true --tests 
> 'groovy.transform.stc.MethodReferenceTest*'
> {code}
> *Actual:* 
> {{MethodReferenceTest$NativeMethodReferenceBytecodeTest.testPrivateConstructorOfNestedClassIsCalledDirectlyFromClosureOrLambda}}
>  fails with "AssertionError: method ctorRef$doCall$0 not found".
> *Expected:* the test passes with and without the flag.
> The test looks up the generated classes {{C$_inClosure_closure1}} and 
> {{C$_inLambda_lambda2}} by name. With closure packing on, the closure body is 
> hoisted into {{C}} and the lambda class becomes {{C$_inLambda_lambda1}}. The 
> generated code is correct (the packed helper still calls the private Box 
> constructor with INVOKESPECIAL). The {{@PackedClosures}} javadoc lists 
> per-literal class names as a known difference, so the test's assumption is 
> what is wrong.



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

Reply via email to