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

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

codecov-commenter commented on PR #3026:
URL: https://github.com/apache/groovy/pull/3026#issuecomment-6390393317

   ## 
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3026?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 Report
   :x: Patch coverage is `91.25000%` with `21 lines` in your changes missing 
coverage. Please review.
   :white_check_mark: Project coverage is 72.5537%. Comparing base 
([`98c2f9f`](https://app.codecov.io/gh/apache/groovy/commit/98c2f9f106d2ee368278ca33d105e540bf23baf0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
 to head 
([`896ef4b`](https://app.codecov.io/gh/apache/groovy/commit/896ef4b31f1acd877f28801e75ba395047c9493c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 4 commits behind head on master.
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3026?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Patch % | Lines |
   |---|---|---|
   | 
[...haus/groovy/classgen/asm/sc/SamAdapterFactory.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FSamAdapterFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TYW1BZGFwdGVyRmFjdG9yeS5qYXZh)
 | 90.4546% | [2 Missing and 19 partials :warning: 
](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   [![Impacted file tree 
graph](https://app.codecov.io/gh/apache/groovy/pull/3026/graphs/tree.svg?width=650&height=150&src=pr&token=1r45138NfQ&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   
   ```diff
   @@                Coverage Diff                 @@
   ##               master      #3026        +/-   ##
   ==================================================
   + Coverage     72.5157%   72.5537%   +0.0380%     
   - Complexity      40761      40818        +57     
   ==================================================
     Files            1644       1645         +1     
     Lines          143027     143276       +249     
     Branches        26899      26961        +62     
   ==================================================
   + Hits           103717     103952       +235     
   + Misses          29759      29755         -4     
   - Partials         9551       9569        +18     
   ```
   
   | [Files with missing 
lines](https://app.codecov.io/gh/apache/groovy/pull/3026?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
 | Coverage Δ | |
   |---|---|---|
   | 
[...rg/codehaus/groovy/classgen/asm/ClosureWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FClosureWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9DbG9zdXJlV3JpdGVyLmphdmE=)
 | `90.0538% <100.0000%> (+0.0134%)` | :arrow_up: |
   | 
[...org/codehaus/groovy/classgen/asm/OperandStack.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FOperandStack.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9PcGVyYW5kU3RhY2suamF2YQ==)
 | `78.3784% <100.0000%> (+0.7386%)` | :arrow_up: |
   | 
[...oovy/classgen/asm/sc/StaticTypesClosureWriter.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FStaticTypesClosureWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TdGF0aWNUeXBlc0Nsb3N1cmVXcml0ZXIuamF2YQ==)
 | `63.4146% <100.0000%> (+1.2298%)` | :arrow_up: |
   | 
[...codehaus/groovy/control/CompilerConfiguration.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fcontrol%2FCompilerConfiguration.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NvbnRyb2wvQ29tcGlsZXJDb25maWd1cmF0aW9uLmphdmE=)
 | `75.4190% <ø> (ø)` | |
   | 
[...vy/transform/sc/StaticCompilationMetadataKeys.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fsc%2FStaticCompilationMetadataKeys.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zYy9TdGF0aWNDb21waWxhdGlvbk1ldGFkYXRhS2V5cy5qYXZh)
 | `100.0000% <100.0000%> (ø)` | |
   | 
[...haus/groovy/classgen/asm/sc/SamAdapterFactory.java](https://app.codecov.io/gh/apache/groovy/pull/3026?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2Fsc%2FSamAdapterFactory.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9zYy9TYW1BZGFwdGVyRmFjdG9yeS5qYXZh)
 | `90.4546% <90.4546%> (ø)` | |
   
   ... and [21 files with indirect coverage 
changes](https://app.codecov.io/gh/apache/groovy/pull/3026/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
   </details>
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test 
Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, 
report on failures, and find test suite problems.
   - :package: [JS Bundle 
Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save 
yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>




> Static compilation converts closure literals to functional interfaces through 
> a runtime proxy
> ---------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-12492
>                 URL: https://issues.apache.org/jira/browse/GROOVY-12492
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static compilation
>    Affects Versions: 6.0.0
>            Reporter: Scott Murphy Heiberg
>            Priority: Major
>
> Under {{@CompileStatic}}, a closure literal whose target is a functional 
> interface is still compiled to a {{Closure}} subclass and converted at run 
> time. That covers a literal passed to a SAM parameter, assigned or returned 
> as a SAM type, cast with {{(SAM)}}, or coerced with {{as SAM}}. For example:
> {code:groovy}
> @CompileStatic
> int sum(int n) { IntStream.range(0, n).reduce(0) { int a, int b -> a + b } }
> {code}
> compiles to {{invokedynamic 
> cast:(Lgroovy/lang/Closure;)Ljava/util/function/IntBinaryOperator;}}, and the 
> same closure coerced with {{as IntBinaryOperator}} to an {{asType}} call. At 
> run time, {{CachedSAMClass.coerceToSAM}} / 
> {{TypeTransformers.createSAMTransform}} create a {{java.lang.reflect.Proxy}} 
> with a {{ConvertedClosure}} handler, and each call goes through the proxy and 
> {{Closure.call(Object...)}}. The same code written as a lambda uses 
> {{LambdaMetafactory}}.
> Consequences: the proxy and reflective dispatch cost on every call, and in a 
> GraalVM native image each interface must be registered as a proxy, otherwise 
> the statically compiled conversion fails with {{GroovyCastException}}.
> Proposal: an incubating {{groovy.target.closure.sam}} compiler option, off by 
> default, that converts such literals at compile time with a generated adapter 
> class that behaves as the proxy does.
> PR: https://github.com/apache/groovy/pull/3026



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

Reply via email to