dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

AnnotationProcessor detection fails to collect all supported annotation types when multiple annotation processors exist in the same artifact/coordinate

Open marklundbergcrd opened this issue 2 years ago • 1 comments
trafficstars

Build scan link n/a

Plugin version 1.18.0

Gradle version 7.7

(Optional) Android Gradle Plugin (AGP) version n/a

reason output for bugs relating to incorrect advice n/a

Describe the bug When annotation processor dependencies are examined, a list of supported annotation types is found and assigned to an AnnotationProcessorDependency object for a specific coordinate. When multiple annotation processors are available in the artifact found for a given coordinate, only the supported annotations types from the last discovered annotation processor are saved. All other annotations processors are then marked as not needed during evaluation because their lists of supported annotation types were accidentally discarded.

To Reproduce Steps to reproduce the behavior:

  1. Create a jar that contains two annotation processors and lists them in src\main\resources\META-INF\services\javax.annotation.processing.Processor
  2. Create a project that uses annotations from the first processor listed in the processor metadata but do not include annotations from the second processor.
  3. projectHealth indicates that the annotation processor is unused.

Expected behavior If any of the supported annotation types from any of the annotation processors included in a dependency are used, then the dependency is considered as 'used'.

Additional context n/a

marklundbergcrd avatar Jan 30 '23 21:01 marklundbergcrd

Thanks for the issue. It would help a lot if you provided a minimal reproducer project, or at the very least indicated an existing library that has multiple annotation processors.

autonomousapps avatar Feb 02 '23 20:02 autonomousapps