Skip to content

Class level @Generated annotation does not work for retentionPolicy CLASS #797

@maikebertpsc

Description

@maikebertpsc

Steps to reproduce

JaCoCo version: 0.8.2
Tool integration: Maven/SonarQube

Expected behaviour

We created a @Generated annotation with retention policy CLASS:

@Target({ElementType.CONSTRUCTOR, ElementType.METHOD, ElementType.FIELD, ElementType.TYPE})
@Retention(RetentionPolicy.CLASS)
public @interface Generated {
    String by() default "";
}

SonarQube is working fine ignoring new methods for coverage annotated with that annotation.
We expect to have this working fine also when used on class level.

Actual behaviour

But instead usage on class level is just ignored. All the lines are still reported to need coverage.

Even worse: When used on class and method level the method level annotation stops working also.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions