Scott Murphy Heiberg created GROOVY-12657:
---------------------------------------------

             Summary: 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


{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