[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=16201141#comment-16201141 ]

ASF GitHub Bot commented on GROOVY-8352:
----------------------------------------

Github user paulk-asert commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/617#discussion_r144158718
 
    --- Diff: src/main/groovy/transform/Generated.java ---
    @@ -0,0 +1,36 @@
    +/*
    + *  Licensed to the Apache Software Foundation (ASF) under one
    + *  or more contributor license agreements.  See the NOTICE file
    + *  distributed with this work for additional information
    + *  regarding copyright ownership.  The ASF licenses this file
    + *  to you under the Apache License, Version 2.0 (the
    + *  "License"); you may not use this file except in compliance
    + *  with the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + *  Unless required by applicable law or agreed to in writing,
    + *  software distributed under the License is distributed on an
    + *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + *  KIND, either express or implied.  See the License for the
    + *  specific language governing permissions and limitations
    + *  under the License.
    + */
    +package groovy.transform;
    +
    +import java.lang.annotation.ElementType;
    +import java.lang.annotation.Retention;
    +import java.lang.annotation.RetentionPolicy;
    +import java.lang.annotation.Target;
    +
    +/**
    + * The Generated annotation is used to mark members that have been generated.
    + *
    + * @author Andres Almiray
    + * @author Jochen Theodorou
    + * @author Mark Hoffmann
    --- End diff --
   
    Actually, we are mostly trying not to use @author tags these days - though we haven't made it mandatory.
   
    Apache encourage removal of @author tags. It's not a mandated rule but they err on the side of wanting the whole community to own the whole codebase rather than people being put off by not wanting to touch a file "owned" by someone else. Git will tell us who the contributor was on a more fine-grained and accurate level than such tags anyway but obviously won't capture multiple authors committing under one of those names. Make sure anyone who has made a significant contribution is added into the `pomconfigurer.gradle` file.


> 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
(v6.4.14#64029)