[
https://issues.apache.org/jira/browse/GROOVY-12235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18102257#comment-18102257
]
ASF GitHub Bot commented on GROOVY-12235:
-----------------------------------------
codecov-commenter commented on PR #2767:
URL: https://github.com/apache/groovy/pull/2767#issuecomment-5198529484
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2767?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 69.9836%. Comparing base
([`2f85f42`](https://app.codecov.io/gh/apache/groovy/commit/2f85f423fe37747156874953ad368a30be9418df?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`37a37ff`](https://app.codecov.io/gh/apache/groovy/commit/37a37fffcdd1bf21ff1553f68a7d486ba2bc5b40?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2767?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2767 +/- ##
==================================================
- Coverage 69.9869% 69.9836% -0.0033%
Complexity 35529 35529
==================================================
Files 1557 1557
Lines 131686 131688 +2
Branches 24174 24173 -1
==================================================
- Hits 92163 92160 -3
- Misses 31189 31191 +2
- Partials 8334 8337 +3
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2767?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/AsmClassGenerator.java](https://app.codecov.io/gh/apache/groovy/pull/2767?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2FAsmClassGenerator.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL0FzbUNsYXNzR2VuZXJhdG9yLmphdmE=)
| `84.7129% <100.0000%> (ø)` | |
|
[...g/codehaus/groovy/classgen/asm/CallSiteWriter.java](https://app.codecov.io/gh/apache/groovy/pull/2767?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2Fasm%2FCallSiteWriter.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL2FzbS9DYWxsU2l0ZVdyaXRlci5qYXZh)
| `86.6667% <100.0000%> (+0.1282%)` | :arrow_up: |
... and [4 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2767/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>
> Interface default method without dynamic calls references unemitted call-site
> helper under indy=false
> -----------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12235
> URL: https://issues.apache.org/jira/browse/GROOVY-12235
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Assignee: Paul King
> Priority: Major
>
> An interface {{default}} method whose body contains *no* dynamic code (e.g.
> {{return null}}) is broken under {{indy=false}}. GROOVY-11982 routes the
> call-site array prologue to the synthetic helper class ({{MyInterface$1}}),
> but the helper is only materialised when at least one named call site is
> registered. The prologue ({{INVOKESTATIC $getCallSiteArray()}}) is emitted
> unconditionally for every method body, so a default method with zero dynamic
> calls ends up with a dangling {{Methodref}} to a class that is never
> generated, and the first invocation throws {{NoClassDefFoundError:
> MyInterface$1}}.
> Reproducer:
> {code:groovy}
> import org.codehaus.groovy.control.CompilerConfiguration
> def config = new CompilerConfiguration()
> config.optimizationOptions.put('indy', false)
> new GroovyShell(config).evaluate '''
> interface MyInterface {
> default Object defaultValue() {
> return null
> }
> }
> class MyImpl implements MyInterface {
> }
> assert new MyImpl().defaultValue() == null
> '''
> {code}
> Expected: assertion passes.
> Actual (master / 5.0.x / 5.1.x with the GROOVY-11982 fix):
> {noformat}
> java.lang.NoClassDefFoundError: MyInterface$1
> at MyInterface.defaultValue(Script1.groovy)
> {noformat}
> On releases predating the GROOVY-11982 fix (e.g. 5.0.4) the same shape fails
> with {{IncompatibleClassChangeError}} instead, because the prologue's owner
> is the interface itself — so this shape has never worked under
> {{indy=false}}; the fix only changed the failure mode.
> Root cause: {{AsmClassGenerator.visitStdMethod}} calls
> {{CallSiteWriter.makeSiteEntry()}} before the method body is visited, so the
> prologue cannot know the body will register no call sites. The guard in
> {{AsmClassGenerator.createInterfaceSyntheticStaticFields}} checks
> {{getCallSites().isEmpty()}}, which only reflects *named* call sites, and
> skips emitting the helper.
> Suggested fix: materialise the helper whenever a prologue was actually
> emitted for the interface (e.g. track a flag in
> {{CallSiteWriter.makeSiteEntry()}}), not only when named call sites were
> registered. A helper with an empty {{CallSite[]}} array is valid. This also
> covers static interface methods with no dynamic code.
> The existing {{Groovy11982.groovy}} tests all use default methods *with*
> dynamic bodies (GStrings, dynamic calls), which is why this gap went
> unnoticed.
> Real-world impact: hit by the Grails 9 / Groovy 6 canary (apache/grails-core
> PR 15558) — {{grails.core.GrailsApplicationLifeCycle#beanRegistrar()}}
> ({{default ... return null}}) broke app boot under {{-PgrailsIndy=false}};
> Grails worked around it by converting the interface to Java (commit
> 20e8ec71d7e4). The workaround row can be removed once this is fixed.
> Should be backported to 5.1.x and 5.0.x, which carry the same residual gap
> via the GROOVY-11982 backport.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)