Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8352

Add a @Generated annotation to mark generated members

    XMLWordPrintableJSON

Details

    Description

      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

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              aalmiray Andres Almiray
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: