Class AnnotationScanner

java.lang.Object
com.arc_e_tect.gradle.jacoco.scan.AnnotationScanner

public class AnnotationScanner extends Object
Parses a single Java source file and collects every element that carries the configured exclusion annotation.

Handles classes, constructors, methods, and fields, including in nested classes. Anonymous classes are ignored because they cannot bear annotations on their declaration.

  • Constructor Details

    • AnnotationScanner

      public AnnotationScanner(String annotationSimpleName)
      Creates a scanner that looks for the given annotation.
      Parameters:
      annotationSimpleName - simple (unqualified) name of the exclusion annotation
  • Method Details

    • scan

      public List<ExcludedElement> scan(File sourceFile) throws IOException
      Scans one .java source file and returns every annotated element.
      Parameters:
      sourceFile - the file to parse
      Returns:
      possibly-empty list of excluded elements, never null
      Throws:
      IOException - if the file cannot be read