Package edu.umd.cs.findbugs.detect
Class NoteSuppressedWarnings
- java.lang.Object
-
- edu.umd.cs.findbugs.visitclass.BetterVisitor
-
- edu.umd.cs.findbugs.visitclass.PreorderVisitor
-
- edu.umd.cs.findbugs.visitclass.AnnotationVisitor
-
- edu.umd.cs.findbugs.detect.NoteSuppressedWarnings
-
- All Implemented Interfaces:
Detector,FirstPassDetector,NonReportingDetector,Priorities,org.apache.bcel.classfile.Visitor
public class NoteSuppressedWarnings extends AnnotationVisitor implements Detector, NonReportingDetector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classNoteSuppressedWarnings.RecordComponentSuppressors
-
Field Summary
Fields Modifier and Type Field Description private booleanisRecordFor records the header is compiled into fields, accessor methods and a canonical constructor.private java.util.Set<java.lang.String>packagesprivate java.util.List<NoteSuppressedWarnings.RecordComponentSuppressors>recordComponentsprivate java.util.Map<java.lang.String,NoteSuppressedWarnings.RecordComponentSuppressors>recordComponentsByNameprivate SuppressionMatchersuppressionMatcherprivate booleanvisitingCanonicalRecordConstructor-
Fields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description NoteSuppressedWarnings(BugReporter bugReporter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static booleanisConstructor(org.apache.bcel.classfile.Method method)static booleanisSuppressWarnings(java.lang.String annotationClass)voidreport()This method is called after all classes to be visited.private voidsuppressParameterWarning(int parameter, java.lang.String pattern, SuppressMatchType matchType)private voidsuppressWarning(java.lang.String pattern, SuppressMatchType matchType)voidvisitAfter(org.apache.bcel.classfile.JavaClass obj)voidvisitAnnotation(java.lang.String annotationClass, java.util.Map<java.lang.String,org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)Visit annotation on a class, field or methodvoidvisitClassContext(ClassContext classContext)Visit the ClassContext for a class which should be analyzed for instances of bug patterns.voidvisitField(org.apache.bcel.classfile.Field field)voidvisitMethod(org.apache.bcel.classfile.Method method)voidvisitParameterAnnotation(int p, java.lang.String annotationClass, java.util.Map<java.lang.String,org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)Visit annotation on a method parameter-
Methods inherited from class edu.umd.cs.findbugs.visitclass.AnnotationVisitor
getAnnotationParameterAsEnum, getAnnotationParameterAsString, getAnnotationParameterAsStringArray, visitAnnotation, visitParameterAnnotation, visitSyntheticParameterAnnotation
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.PreorderVisitor
amVisitingMainMethod, asUnsignedByte, doVisitMethod, getClassDescriptor, getClassName, getCode, getConstantPool, getDottedClassName, getDottedFieldSig, getDottedMethodSig, getDottedSuperclassName, getField, getFieldDescriptor, getFieldIsStatic, getFieldName, getFieldSig, getFullyQualifiedFieldName, getFullyQualifiedMethodName, getMethod, getMethodDescriptor, getMethodName, getMethodSig, getMethodVisitOrder, getNumberArguments, getNumberMethodArguments, getPackageName, getSizeOfSurroundingTryBlock, getSizeOfSurroundingTryBlock, getSourceFile, getStringFromIndex, getSuperclassName, getSurroundingCaughtExceptions, getSurroundingCaughtExceptions, getSurroundingCaughtExceptionTypes, getSurroundingTryBlock, getSurroundingTryBlock, getThisClass, getXClass, getXField, getXMethod, hasInterestingClass, hasInterestingMethod, isVisitMethodsInCallOrder, setupVisitorForClass, setVisitMethodsInCallOrder, shouldVisit, toString, visitAfter, visitAnnotationDefault, visitAnnotationEntry, visitBootstrapMethods, visitCode, visitConstantInvokeDynamic, visitConstantMethodHandle, visitConstantMethodType, visitConstantModule, visitConstantPackage, visitConstantPool, visitEnclosingMethod, visitingField, visitingMethod, visitInnerClasses, visitJavaClass, visitLineNumberTable, visitLocalVariableTable, visitMethodParameters, visitParameterAnnotationEntry, visitStackMap, visitStackMapEntry
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.BetterVisitor
clone, report, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitCodeException, visitConstantClass, visitConstantDouble, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantLong, visitConstantMethodref, visitConstantNameAndType, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitExceptionTable, visitInnerClass, visitLineNumber, visitLocalVariable, visitLocalVariableTypeTable, visitSignature, visitSourceFile, visitSynthetic, visitUnknown
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.bcel.classfile.Visitor
visitConstantDynamic, visitMethodParameter, visitModule, visitModuleExports, visitModuleMainClass, visitModuleOpens, visitModulePackages, visitModuleProvides, visitModuleRequires, visitNestHost, visitNestMembers, visitRecord, visitRecordComponent, visitStackMapType
-
-
-
-
Field Detail
-
packages
private final java.util.Set<java.lang.String> packages
-
isRecord
private boolean isRecord
For records the header is compiled into fields, accessor methods and a canonical constructor. ASuppressWarningsannotation 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 inSuppressionMatcher.match(edu.umd.cs.findbugs.BugInstance)
-
visitingCanonicalRecordConstructor
private boolean visitingCanonicalRecordConstructor
-
recordComponents
private final java.util.List<NoteSuppressedWarnings.RecordComponentSuppressors> recordComponents
-
recordComponentsByName
private final java.util.Map<java.lang.String,NoteSuppressedWarnings.RecordComponentSuppressors> recordComponentsByName
-
suppressionMatcher
private final SuppressionMatcher suppressionMatcher
-
-
Constructor Detail
-
NoteSuppressedWarnings
public NoteSuppressedWarnings(BugReporter bugReporter)
-
-
Method Detail
-
visitClassContext
public void visitClassContext(ClassContext classContext)
Description copied from interface:DetectorVisit the ClassContext for a class which should be analyzed for instances of bug patterns.- Specified by:
visitClassContextin interfaceDetector- Parameters:
classContext- the ClassContext
-
visitField
public void visitField(org.apache.bcel.classfile.Field field)
- Specified by:
visitFieldin interfaceorg.apache.bcel.classfile.Visitor- Overrides:
visitFieldin classBetterVisitor
-
visitMethod
public void visitMethod(org.apache.bcel.classfile.Method method)
- Specified by:
visitMethodin interfaceorg.apache.bcel.classfile.Visitor- Overrides:
visitMethodin classBetterVisitor
-
isConstructor
private static boolean isConstructor(org.apache.bcel.classfile.Method method)
-
visitAfter
public void visitAfter(org.apache.bcel.classfile.JavaClass obj)
- Overrides:
visitAfterin classPreorderVisitor
-
visitAnnotation
public void visitAnnotation(java.lang.String annotationClass, java.util.Map<java.lang.String,org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)Description copied from class:AnnotationVisitorVisit annotation on a class, field or method- Overrides:
visitAnnotationin classAnnotationVisitor- Parameters:
annotationClass- class of annotationmap- map from names to valuesruntimeVisible- true if annotation is runtime visible
-
isSuppressWarnings
public static boolean isSuppressWarnings(java.lang.String annotationClass)
-
visitParameterAnnotation
public void visitParameterAnnotation(int p, java.lang.String annotationClass, java.util.Map<java.lang.String,org.apache.bcel.classfile.ElementValue> map, boolean runtimeVisible)Description copied from class:AnnotationVisitorVisit annotation on a method parameter- Overrides:
visitParameterAnnotationin classAnnotationVisitor- Parameters:
p- parameter number, starting at zero ("this" parameter is not counted)annotationClass- class of annotationmap- map from names to valuesruntimeVisible- true if annotation is runtime visible
-
suppressParameterWarning
private void suppressParameterWarning(int parameter, java.lang.String pattern, SuppressMatchType matchType)
-
suppressWarning
private void suppressWarning(java.lang.String pattern, SuppressMatchType matchType)
-
-