[
https://issues.apache.org/jira/browse/GROOVY-12451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18127311#comment-18127311
]
ASF GitHub Bot commented on GROOVY-12451:
-----------------------------------------
codecov-commenter commented on PR #2980:
URL: https://github.com/apache/groovy/pull/2980#issuecomment-6183944305
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2980?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 72.2658%. Comparing base
([`237fdb5`](https://app.codecov.io/gh/apache/groovy/commit/237fdb54b39c4f9d27064aeca0870eadb0888da3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`43994d3`](https://app.codecov.io/gh/apache/groovy/commit/43994d37d8a275fb286e112f2626e5545c587ba5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2980?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2980 +/- ##
==================================================
+ Coverage 72.2567% 72.2658% +0.0091%
- Complexity 40508 40514 +6
==================================================
Files 1643 1643
Lines 142564 142564
Branches 26769 26769
==================================================
+ Hits 103012 103025 +13
+ Misses 30091 30084 -7
+ Partials 9461 9455 -6
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2980?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...in/java/org/codehaus/groovy/classgen/Verifier.java](https://app.codecov.io/gh/apache/groovy/pull/2980?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fclassgen%2FVerifier.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2NsYXNzZ2VuL1ZlcmlmaWVyLmphdmE=)
| `90.2962% <100.0000%> (ø)` | |
... and [11 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2980/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>
> A record with a boolean component x and a hand-written isX() gets no x()
> accessor
> ---------------------------------------------------------------------------------
>
> Key: GROOVY-12451
> URL: https://issues.apache.org/jira/browse/GROOVY-12451
> Project: Groovy
> Issue Type: Bug
> Components: Compiler
> Affects Versions: 4.0.31, 5.0.6, 5.1.3, 6.0.0
> Reporter: Mattias Reichel
> Assignee: Paul King
> Priority: Major
>
> If a record declares a method that looks like a getter for one of its boolean
> components, such as {{isDone()}} for component {{done}}, Groovy does not
> generate the component's accessor {{done()}}. Static compilation still
> accepts calls to {{done()}}, which then fail at runtime.
> {code:groovy}
> import groovy.transform.CompileStatic
> @CompileStatic
> record S8(boolean done) {
> boolean isDone() { done }
> }
> @CompileStatic
> class M8 {
> static void main(String[] args) { println new S8(true).done() }
> }
> {code}
> {noformat}
> $ groovyc D.groovy && groovy M8
> Exception in thread "main" java.lang.NoSuchMethodError: 'boolean S8.done()'
> at M8.main(D.groovy:7)
> $ javap S8
> public final class S8 extends java.lang.Record {
> public S8(boolean);
> public boolean isDone();
> public final boolean equals(java.lang.Object);
> ...
> {noformat}
> The class is still a record with one component, but that component has no
> accessor:
> {code:java}
> RecordComponent[] rc = S8.class.getRecordComponents(); // length 1
> rc[0].getAccessor(); // null
> {code}
> So Java code calling {{s8.done()}} doesn't compile, and anything that reads
> records through their component accessors breaks, e.g. {{java.io}}
> serialization of a {{Serializable}} record or Jackson.
> What I found:
> * A dynamically compiled caller fails at runtime with
> {{MissingMethodException}}, listing {{isDone()}} as a possible solution.
> * It happens with or without {{@CompileStatic}}.
> Reproduced with 4.0.31, 5.0.6, 5.1.3 and 6.0.0 on JDK 21.
> Expected: the accessor {{done()}} is always generated (JLS 8.10.3), and
> {{isDone()}} is an additional method. Otherwise compilation should fail,
> rather than produce a record without an accessor and accept calls to it
--
This message was sent by Atlassian Jira
(v8.20.10#820010)