[
https://issues.apache.org/jira/browse/MDEP-594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Hubold updated MDEP-594:
--------------------------------
Environment:
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426;
2017-04-03T21:39:06+02:00)
Java version: 1.8.0_144, vendor: Oracle Corporation
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.8.0-34-generic", arch: "amd64", family: "unix"
was:java version "1.8.0_144"
> Dependency reported as "unused declared" when runtime-retention annotation is
> used
> ----------------------------------------------------------------------------------
>
> Key: MDEP-594
> URL: https://issues.apache.org/jira/browse/MDEP-594
> Project: Maven Dependency Plugin
> Issue Type: Bug
> Components: analyze
> Affects Versions: 3.0.0
> Environment: Apache Maven 3.5.0
> (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
> Java version: 1.8.0_144, vendor: Oracle Corporation
> Default locale: en_US, platform encoding: ANSI_X3.4-1968
> OS name: "linux", version: "4.8.0-34-generic", arch: "amd64", family: "unix"
> Reporter: Andreas Hubold
> Attachments: example.tgz
>
>
> In the attached example project, module "usage" uses annotation {{@Example}}:
> {code}
> public interface Usage {
> @Example String getEmail();
> }
> {code}
> which is defined in module "annotation" as:
> {code}
> @Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER})
> @Retention(RetentionPolicy.RUNTIME)
> public @interface Example {
> }
> {code}
> Consequently, the pom.xml of module "usage" defines a compile-dependency to
> module "annotation" but the dependency:analyze-only goal incorrectly reports
> this as unused dependency:
> {noformat}
> [main] [INFO] --- maven-dependency-plugin:3.0.0:analyze-only
> (analyze-dependencies) @ usage ---
> [main] [WARNING] Unused declared dependencies found:
> [main] [WARNING] com.example:annotation:jar:1.0-SNAPSHOT:compile
> {noformat}
> This false positive is only reported if
> * the annotation is meta-annotated with target TYPE_USE + TYPE_PARAMETER
> * and the source.version/target.version of the compiler plugin for module
> "usage" is 1.8
> There's no false positive if the {{@Target}} meta-annotation is removed or if
> compiler's source/target version is set to 1.7.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)