[
https://issues.apache.org/jira/browse/GROOVY-12415?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116210#comment-18116210
]
ASF GitHub Bot commented on GROOVY-12415:
-----------------------------------------
codecov-commenter commented on PR #2939:
URL: https://github.com/apache/groovy/pull/2939#issuecomment-5705518037
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2939?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 67.2945%. Comparing base
([`f457fe7`](https://app.codecov.io/gh/apache/groovy/commit/f457fe7c38b07afb8c1c1a58f7e7cc50bb320321?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`d2a7888`](https://app.codecov.io/gh/apache/groovy/commit/d2a78889b7d9bf45caa2f701a6b57f29e311bfa5?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/2939?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## GROOVY_5_1_X #2939 +/- ##
======================================================
+ Coverage 67.2937% 67.2945% +0.0008%
- Complexity 29650 29651 +1
======================================================
Files 1384 1384
Lines 117118 117118
Branches 20602 20602
======================================================
+ Hits 78813 78814 +1
- Misses 31752 31753 +1
+ Partials 6553 6551 -2
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2939?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[...us/groovy/ast/decompiled/ClassSignatureParser.java](https://app.codecov.io/gh/apache/groovy/pull/2939?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Fast%2Fdecompiled%2FClassSignatureParser.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L2FzdC9kZWNvbXBpbGVkL0NsYXNzU2lnbmF0dXJlUGFyc2VyLmphdmE=)
| `96.0784% <100.0000%> (ø)` | |
... and [6 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2939/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>
> Groovy 5 decompiler crashes on TYPE_USE annotation on primitive Java record
> component
> -------------------------------------------------------------------------------------
>
> Key: GROOVY-12415
> URL: https://issues.apache.org/jira/browse/GROOVY-12415
> Project: Groovy
> Issue Type: Bug
> Affects Versions: 5.0.8, 5.1.2
> Reporter: Piotr Boryczko
> Assignee: Paul King
> Priority: Major
> Attachments: groovy-record-primitive-type-annotation.zip
>
>
> Groovy 5 throws `GroovyBugError` while lazily configuring a decompiled,
> precompiled Java record when a primitive record component carries a
> `TYPE_USE` annotation:
>
> {code:java}
> Caught: BUG! Adding type annotation @TypeAnnotation to non-redirect node: int
> {code}
> The failure is in *ClassSignatureParser.configureClass*. It unconditionally
> passes the primitive component's *ClassNode* to
> *Annotations.addTypeAnnotations*, which eventually calls
> *ClassNode.addTypeAnnotation*. Shared primitive nodes are not redirect nodes,
> so that method aborts.
> This occurs in ordinary applications through frameworks that inspect or infer
> types from records. Jakarta Validation makes it particularly easy to
> encounter:
> constraints such as *@Min*, and *@Max* include *TYPE_USE* in their
> targets.
> The attached reproducer does not use Spock, Jakarta Validation, Gradle, or any
> third-party dependency other than Groovy itself.
> h5. Groovy 5 source location
> *org.codehaus.groovy.ast.decompiled.ClassSignatureParser.configureClass*:
> {code:java}
> RecordComponentNode recordComponent =
> new RecordComponentNode(classNode, rc.name, type[0]);
> Annotations.addAnnotations(rc, recordComponent, resolver);
> Annotations.addTypeAnnotations(rc, type[0], resolver);
> {code}
> Possible narrow fix for Groovy 5
> Guard primitive component types before calling *addTypeAnnotations*:
> {code:java}
> if (!ClassHelper.isPrimitiveType(type[0])) {
> Annotations.addTypeAnnotations(rc, type[0], resolver);
> }
> {code}
> This guard was tested locally against Groovy 5.0.8: the reproducer fails with
> the original class and succeeds when the patched *ClassSignatureParser* is
> placed first on the compiler classpath.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)