Class NoteSuppressedWarnings

All Implemented Interfaces:
Detector, FirstPassDetector, NonReportingDetector, Priorities, org.apache.bcel.classfile.Visitor

public class NoteSuppressedWarnings extends AnnotationVisitor implements Detector, NonReportingDetector
  • Field Details

    • packages

      private final Set<String> packages
    • isRecord

      private boolean isRecord
      For records the header is compiled into fields, accessor methods and a canonical constructor. A SuppressWarnings annotation in the header is applied to the corresponding field, accessor method and parameter of the canonical constructor. In the end we want to report unnecessary suppressions, however when only one of the three suppressors is matched we do not want to report the two others as unnecessary. We link the suppressors together so we can detect whether at least one of them was matched in SuppressionMatcher.match(edu.umd.cs.findbugs.BugInstance)
    • visitingCanonicalRecordConstructor

      private boolean visitingCanonicalRecordConstructor
    • recordComponents

    • recordComponentsByName

      private final Map<String, NoteSuppressedWarnings.RecordComponentSuppressors> recordComponentsByName
    • suppressionMatcher

      private final SuppressionMatcher suppressionMatcher
  • Constructor Details

    • NoteSuppressedWarnings

      public NoteSuppressedWarnings(BugReporter bugReporter)
  • Method Details

    • visitClassContext

      public void visitClassContext(ClassContext classContext)
      Description copied from interface: Detector
      Visit the ClassContext for a class which should be analyzed for instances of bug patterns.
      Specified by:
      visitClassContext in interface Detector
      Parameters:
      classContext - the ClassContext
    • visitField

      public void visitField(org.apache.bcel.classfile.Field field)
      Specified by:
      visitField in interface org.apache.bcel.classfile.Visitor
      Overrides:
      visitField in class BetterVisitor
    • visitMethod

      public void visitMethod(org.apache.bcel.classfile.Method method)
      Specified by:
      visitMethod in interface org.apache.bcel.classfile.Visitor
      Overrides:
      visitMethod in class BetterVisitor
    • isConstructor

      private static boolean isConstructor(org.apache.bcel.classfile.Method method)
    • visitAfter

      public void visitAfter(org.apache.bcel.classfile.JavaClass obj)
      Overrides:
      visitAfter in class PreorderVisitor
    • visitAnnotation

      public void visitAnnotation(String annotationClass, Map<String, org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)
      Description copied from class: AnnotationVisitor
      Visit annotation on a class, field or method
      Overrides:
      visitAnnotation in class AnnotationVisitor
      Parameters:
      annotationClass - class of annotation
      map - map from names to values
      runtimeVisible - true if annotation is runtime visible
    • isSuppressWarnings

      public static boolean isSuppressWarnings(String annotationClass)
    • visitParameterAnnotation

      public void visitParameterAnnotation(int p, String annotationClass, Map<String, org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)
      Description copied from class: AnnotationVisitor
      Visit annotation on a method parameter
      Overrides:
      visitParameterAnnotation in class AnnotationVisitor
      Parameters:
      p - parameter number, starting at zero ("this" parameter is not counted)
      annotationClass - class of annotation
      map - map from names to values
      runtimeVisible - true if annotation is runtime visible
    • suppressParameterWarning

      private void suppressParameterWarning(int parameter, String pattern, SuppressMatchType matchType)
    • suppressWarning

      private void suppressWarning(String pattern, SuppressMatchType matchType)
    • report

      public void report()
      Description copied from interface: Detector
      This method is called after all classes to be visited. It should be used by any detectors which accumulate information over all visited classes to generate results.
      Specified by:
      report in interface Detector