[jira] [Commented] (GROOVY-8352) Add a @Generated annotation to mark generated members

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Commented] (GROOVY-8352) Add a @Generated annotation to mark generated members

JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/GROOVY-8352?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16200387#comment-16200387 ]

ASF GitHub Bot commented on GROOVY-8352:

GitHub user aalmiray opened a pull request:



    See https://issues.apache.org/jira/browse/GROOVY-8352
    Retention policy is set to `RUNTIME`in order to allow frameworks and libraries to have access to the new metadata.
    There's a breaking change in `Verifier`, a protected method now returns `MethodNode` instead of `void`. This change was reviewed with @blackdrag and deemed the better solution among alternatives (such as duplicate method & deprecate old).
    The JaCoCo team has done their part to prepare their project for this new annotation.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aalmiray/groovy at_generated_annotation

Alternatively you can review and apply these changes as the patch at:


To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #617
commit 2e36707b9446f8b48a85bee26f6ec746d56e8b95
Author: aalmiray <[hidden email]>
Date:   2017-10-11T14:34:27Z

    GROOVY-8352: add a @Generated annotation


> Add a @Generated annotation to mark generated members
> -----------------------------------------------------
>                 Key: GROOVY-8352
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8352
>             Project: Groovy
>          Issue Type: New Feature
>          Components: class generator
>    Affects Versions: 2.6.0-alpha-1
>            Reporter: Andres Almiray
> Rationale:
> Tooling support for Groovy may benefit from having additional information on generated members. We already provide some information by marking certain generated methods as synthetic, however tools such as IDEs hide these methods. The goal of `@Generated` is to mark members that are still visible to IDEs and other tools.
> Example:
> The JaCoCo and Lombok projects have agreed on an annotation named `@lombok.Generated`. This annotation serves as a hint to JaCoCo in order to skip coverage on the annotated elements; this helps JaCoCo in reporting more accurate coverage numbers for source code.
> What would be needed:
> An annotation in the groovy space named `@Generated` that can be used by JaCoCo (or any other tool). We can't use `@javax.annotation.Generated` because its retention policy is `SOURCE` and we need `CLASS` at the very least.
> Modify the Verifier to mark the 5 default GroovyObject methods with this annotation when the inspected class does not provide an implementation for any of these methods.
> Additionally, any AST transformation that creates additional methods/types/fields that should be marked can make use of the new annotation.
> The work required for JaCoCo has already been started and is tracked by https://github.com/jacoco/jacoco/pull/610

This message was sent by Atlassian JIRA