[
https://issues.apache.org/jira/browse/GROOVY-12452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18130844#comment-18130844
]
ASF GitHub Bot commented on GROOVY-12452:
-----------------------------------------
codecov-commenter commented on PR #3014:
URL: https://github.com/apache/groovy/pull/3014#issuecomment-6363853797
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/3014?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 `66.66667%` with `1 line` in your changes missing
coverage. Please review.
:white_check_mark: Project coverage is 72.4388%. Comparing base
([`fa53afa`](https://app.codecov.io/gh/apache/groovy/commit/fa53afab4ff811b7ed93560300cd626d0374842e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`ef5b823`](https://app.codecov.io/gh/apache/groovy/commit/ef5b823c64d59ce7418f6efe2159b28b4b68c7c0?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3014?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Patch % | Lines |
|---|---|---|
|
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3014?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
| 66.6667% | [0 Missing and 1 partial :warning:
](https://app.codecov.io/gh/apache/groovy/pull/3014?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>
[](https://app.codecov.io/gh/apache/groovy/pull/3014?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #3014 +/- ##
==================================================
- Coverage 72.4452% 72.4388% -0.0064%
+ Complexity 40687 40683 -4
==================================================
Files 1644 1644
Lines 142897 142900 +3
Branches 26877 26879 +2
==================================================
- Hits 103522 103515 -7
- Misses 29820 29826 +6
- Partials 9555 9559 +4
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/3014?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...roovy/transform/stc/StaticTypeCheckingVisitor.java](https://app.codecov.io/gh/apache/groovy/pull/3014?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2Fstc%2FStaticTypeCheckingVisitor.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9zdGMvU3RhdGljVHlwZUNoZWNraW5nVmlzaXRvci5qYXZh)
| `87.0624% <66.6667%> (-0.0142%)` | :arrow_down: |
... and [8 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/3014/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>
> STC cannot find the accessor of a record component whose name starts with
> "is" or "get" when called from the same compilation unit
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12452
> URL: https://issues.apache.org/jira/browse/GROOVY-12452
> Project: Groovy
> Issue Type: Bug
> Components: Static Type Checker
> Affects Versions: 4.0.31, 5.0.6, 5.1.3, 6.0.0
> Reporter: Mattias Reichel
> Priority: Major
>
> When a record component is named like a getter, for example {{isActive}} or
> {{{}getName{}}}, the static type checker cannot resolve the record's accessor
> method, {{isActive()}} or {{{}getName(){}}}, while the record is being
> compiled in the same compilation unit. The accessor does exist in the
> generated bytecode.
> {code:groovy}
> import groovy.transform.CompileStatic
> @CompileStatic
> record Flags(boolean isActive) {}
> @CompileStatic
> class Main {
> static void main(String[] args) {
> Flags flags = new Flags(true)
> assert flags.isActive()
> }
> }
> {code}
> {noformat}
> $ groovyc OneFile.groovy
> OneFile.groovy: 10: [Static type checking] - Cannot find matching method
> Flags#isActive(). Please check if the declared type is correct and if the
> method exists.
> @ line 10, column 16.
> assert flags.isActive()
> ^
> {noformat}
> The record itself compiles correctly:
> {noformat}
> $ javap Flags
> public final class Flags extends java.lang.Record {
> public Flags(boolean);
> public boolean isActive();
> ...
> {noformat}
> What I found:
> * The same call compiles when the caller is compiled separately against the
> record's class file.
> * It fails for any component type, e.g. {{{}record Flags(String
> isActive){}}}, and for the {{get}} prefix, e.g. {{record Flags(String
> getName)}} with {{{}flags.getName(){}}}.
> * It also fails inside the record itself, e.g. \{{boolean check() {
> isActive() }}}.
> * Property-style access ({{{}flags.isActive{}}}) compiles.
> * A component without such a prefix ({{{}record Flags(boolean active){}}}
> with {{{}flags.active(){}}}) compiles.
> * A method named {{isActive()}} on an ordinary {{@CompileStatic}} class
> compiles.
> * A dynamically compiled caller works at runtime.
> * It doesn't matter whether the record itself is {{{}@CompileStatic{}}}.
> Reproduced with 4.0.31, 5.0.6, 5.1.3 and 6.0.0 on JDK 21.
> Expected: {{flags.isActive()}} resolves to the record's accessor, as it does
> when the record is compiled separately and as it does in Java.
> Workaround: name the component without the prefix and declare the accessor by
> hand. That has to avoid the related problem where a hand-written {{isX()}}
> suppresses the accessor of component {{x}} (see issue GROOVY-12451).
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)