[
https://issues.apache.org/jira/browse/GROOVY-12413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18116017#comment-18116017
]
ASF GitHub Bot commented on GROOVY-12413:
-----------------------------------------
codecov-commenter commented on PR #2938:
URL: https://github.com/apache/groovy/pull/2938#issuecomment-5697456419
##
[Codecov](https://app.codecov.io/gh/apache/groovy/pull/2938?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 71.5993%. Comparing base
([`0041ce8`](https://app.codecov.io/gh/apache/groovy/commit/0041ce8c3a6364687a59aaad943a3264be4a2237?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache))
to head
([`068da03`](https://app.codecov.io/gh/apache/groovy/commit/068da0352fcd68a71b897950ba937f01f01ba73a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
[](https://app.codecov.io/gh/apache/groovy/pull/2938?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
```diff
@@ Coverage Diff @@
## master #2938 +/- ##
==================================================
+ Coverage 71.5979% 71.5993% +0.0015%
- Complexity 38043 38044 +1
==================================================
Files 1588 1588
Lines 137046 137046
Branches 25493 25493
==================================================
+ Hits 98122 98124 +2
+ Misses 30018 30017 -1
+ Partials 8906 8905 -1
```
| [Files with missing
lines](https://app.codecov.io/gh/apache/groovy/pull/2938?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
| Coverage Δ | |
|---|---|---|
|
[.../groovy/transform/RecordTypeASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2938?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FRecordTypeASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9SZWNvcmRUeXBlQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
| `84.5361% <100.0000%> (ø)` | |
|
[...y/transform/TupleConstructorASTTransformation.java](https://app.codecov.io/gh/apache/groovy/pull/2938?src=pr&el=tree&filepath=src%2Fmain%2Fjava%2Forg%2Fcodehaus%2Fgroovy%2Ftransform%2FTupleConstructorASTTransformation.java&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3JjL21haW4vamF2YS9vcmcvY29kZWhhdXMvZ3Jvb3Z5L3RyYW5zZm9ybS9UdXBsZUNvbnN0cnVjdG9yQVNUVHJhbnNmb3JtYXRpb24uamF2YQ==)
| `85.7759% <100.0000%> (ø)` | |
... and [8 files with indirect coverage
changes](https://app.codecov.io/gh/apache/groovy/pull/2938/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>
> TYPE_USE annotations on primitive record components and tuple-constructor
> parameters are duplicated or misapplied
> -----------------------------------------------------------------------------------------------------------------
>
> Key: GROOVY-12413
> URL: https://issues.apache.org/jira/browse/GROOVY-12413
> Project: Groovy
> Issue Type: Bug
> Reporter: Paul King
> Priority: Major
> Fix For: 5.1.2, 6.0.0-RC-2
>
>
> When a record component or a {{@TupleConstructor}} property has a primitive
> type annotated with a {{TYPE_USE}} annotation, the compiler writes the type
> annotation to the wrong places or writes it several times.
> h3. Records
> {code:groovy}
> import java.lang.annotation.*
> @Retention(RetentionPolicy.RUNTIME)
> @Target(ElementType.TYPE_USE)
> @interface NonNeg {}
> record Point(@NonNeg int x, @NonNeg String s) {}
> def rc = Point.recordComponents[0]
> println rc.annotatedType.annotations
> {code}
> Actual:
> {noformat}
> java.lang.annotation.AnnotationFormatError: Duplicate annotation for class:
> interface NonNeg: @NonNeg()
> {noformat}
> The {{int}} component's type annotation is written three times each to the
> Record attribute, the backing field, the accessor return type and the
> canonical constructor parameter. Any reflective read of it fails with the
> error above, including:
> * {{RecordComponent.getAnnotatedType()}}
> * {{Field.getAnnotatedType()}}
> * {{Method.getAnnotatedReturnType()}}
> * {{Constructor.getAnnotatedParameterTypes()}}
> For the constructor this fails for every parameter, including the {{String}}
> one. Reference-type components ({{@NonNeg String s}}) are otherwise written
> correctly.
> Expected: a single {{@NonNeg}} on each of the four places, as javac produces
> for the equivalent Java record.
> h3. @TupleConstructor
> {code:groovy}
> @groovy.transform.TupleConstructor
> class C { @NonNeg int a; @NonNeg String s }
> println C.getDeclaredConstructor(int,
> String).annotatedParameterTypes*.annotations
> {code}
> Actual: {{[[@NonNeg()], []]}}. The {{int}} parameter picks up the field's
> type annotation, but the {{String}} parameter does not.
> Expected: {{[[], []]}}. Tuple constructor parameters do not copy the
> property's annotations, so primitive and reference properties should behave
> the same way.
> h3. Cause
> {{ClassNode.getPlainNodeReference()}} returns the node itself for primitive
> types instead of a new reference. {{RecordTypeASTTransformation}} (record
> component type) and {{TupleConstructorASTTransformation.createParam}}
> (constructor parameter type) both call it. So for a primitive property, the
> component, field, accessor return type and constructor parameter all share
> one {{ClassNode}}. {{ExtendedVerifier}} then adds the {{TYPE_USE}}
> annotations to that shared node once for each place it appears.
> h3. Fix
> Use {{getPlainNodeReference(false)}} at both call sites so primitive types
> also get their own node, as {{ExtendedVerifier.visitConstructor}} already
> does (GROOVY-10937).
> Reproduced on 5.1.2 and on master.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)