From 029130a478e1c4c585c965dca224961df18c7034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Tue, 17 Sep 2024 17:00:42 -0300 Subject: [PATCH] Use a custom annotation to ignore javacc generated code --- javacc-wrapper.xml | 21 ++++++++++++----- .../sourceforge/pmd/annotation/Generated.java | 23 +++++++++++++++++++ pom.xml | 7 +----- 3 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java diff --git a/javacc-wrapper.xml b/javacc-wrapper.xml index 2c43e086d8..bbd50e21a4 100644 --- a/javacc-wrapper.xml +++ b/javacc-wrapper.xml @@ -224,6 +224,11 @@ + + ${parser-name} + + @@ -262,7 +267,8 @@ - + @@ -272,7 +278,8 @@ - + @@ -385,11 +392,12 @@ - +'/> @@ -534,8 +542,9 @@ public final class ${token-constants-name} \{${line.separator} - + diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java b/pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java new file mode 100644 index 0000000000..ab9b46f465 --- /dev/null +++ b/pmd-core/src/main/java/net/sourceforge/pmd/annotation/Generated.java @@ -0,0 +1,23 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * Marks a class as generated code, and therefore to be ignored for code coverage purposes. + * + * @since 7.6.0 + */ +@Retention(RetentionPolicy.CLASS) +@Documented +public @interface Generated { + + /** The generator that produced this code */ + String value() default ""; + +} diff --git a/pom.xml b/pom.xml index f2cb4d826c..216fad4056 100644 --- a/pom.xml +++ b/pom.xml @@ -611,12 +611,7 @@ org.jacoco jacoco-maven-plugin - 0.8.11 - - - **/target/generated-sources/** - - + 0.8.12 org.cyclonedx