Skip to content

Commit

Permalink
Merge pull request #154 from uhafner/generated
Browse files Browse the repository at this point in the history
Add a new @generated annotation (with class retention)
  • Loading branch information
uhafner authored Apr 15, 2020
2 parents c1e04d2 + 8488735 commit a074b05
Showing 1 changed file with 25 additions and 0 deletions.
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 "";
}

0 comments on commit a074b05

Please sign in to comment.