Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new @Generated annotation (with class retention) #154

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/main/java/edu/hm/hafner/util/Generated.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package edu.hm.hafner.util;

import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;

/**
* This annotation is used to mark source code that has been generated or is somehow not relevant for style checking or
* code coverage analysis. This annotation is quite similar to the annotation @{@link javax.annotation.Generated}. The
* main difference is that it has class retention on so is available for tools that work on the bytecode (like JaCoCo,
* PIT, or SpotBugs).
*/
@Retention(CLASS)
@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD,
LOCAL_VARIABLE, PARAMETER})
public @interface Generated {
/**
* An optional property that identifies the code generator.
*
* @return the name of the generator
*/
String[] value() default "";
}