Package edu.umd.cs.findbugs
Class PackageMemberAnnotation
java.lang.Object
edu.umd.cs.findbugs.BugAnnotationWithSourceLines
edu.umd.cs.findbugs.PackageMemberAnnotation
- All Implemented Interfaces:
BugAnnotation,XMLWriteable,XMLWriteableWithMessages,Serializable,Cloneable,Comparable<BugAnnotation>
- Direct Known Subclasses:
ClassAnnotation,FieldAnnotation,MethodAnnotation
Abstract base class for BugAnnotations describing constructs which are
contained in a Java package. Specifically, this includes classes, methods,
and fields.
- Author:
- David Hovemeyer
- See Also:
-
Field Summary
FieldsFields inherited from class edu.umd.cs.findbugs.BugAnnotationWithSourceLines
sourceFileName, sourceLinesFields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPackageMemberAnnotation(String className, String description) Constructor.protectedPackageMemberAnnotation(String className, String description, String sourceFileName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal Stringformat(String key, ClassAnnotation primaryClass) Format the annotation.protected abstract StringformatPackageMember(String key, ClassAnnotation primaryClass) Do default and subclass-specific formatting.final ClassDescriptorGet the class descriptor.final StringGet the dotted class name.Get a description of this bug annotation.final StringGet the package name.final StringGet the dotted class name.booleanIs this annotation used to compute instance hashes or match bug instances across versionsprotected static StringremovePackage(String typeName) protected static StringremovePackageName(String typeName) Shorten a type name by removing the package namevoidsetDescription(String description) Set a description of this bug annotation.protected static StringShorten a type name of remove extraneous components.toString()All PackageMemberAnnotation object share a common toString() implementation.toString(ClassAnnotation primaryClass) Methods inherited from class edu.umd.cs.findbugs.BugAnnotationWithSourceLines
clone, getSourceFileName, getSourceLines, setSourceLinesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface edu.umd.cs.findbugs.BugAnnotation
acceptMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface edu.umd.cs.findbugs.xml.XMLWriteable
writeXMLMethods inherited from interface edu.umd.cs.findbugs.XMLWriteableWithMessages
writeXML
-
Field Details
-
className
-
description
-
-
Constructor Details
-
PackageMemberAnnotation
Constructor.- Parameters:
className- name of the class
-
PackageMemberAnnotation
protected PackageMemberAnnotation(@DottedClassName String className, String description, String sourceFileName) Constructor.- Parameters:
className- name of the class
-
-
Method Details
-
getClassName
Get the dotted class name. -
getSlashedClassName
Get the dotted class name. -
getSimpleClassName
-
getClassDescriptor
Get the class descriptor. -
getPackageName
Get the package name. -
format
Format the annotation. Note that this version (defined by PackageMemberAnnotation) only handles the "class" and "package" keys, and calls formatPackageMember() for all other keys.- Parameters:
key- the keyprimaryClass- The primary class for the bug; some bug annotation format msgs are simplified in relation to that class.- Returns:
- the formatted annotation
-
setDescription
Description copied from interface:BugAnnotationSet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle. -
getDescription
Description copied from interface:BugAnnotationGet a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle. -
shorten
Shorten a type name of remove extraneous components. Candidates for shortening are classes in same package as this annotation and classes in thejava.langpackage. -
removePackage
-
removePackageName
Shorten a type name by removing the package name -
formatPackageMember
Do default and subclass-specific formatting.- Parameters:
key- the key specifying how to do the formattingprimaryClass- TODO
-
toString
All PackageMemberAnnotation object share a common toString() implementation. It uses the annotation description as a pattern for FindBugsMessageFormat, passing a reference to this object as the single message parameter. -
toString
- Specified by:
toStringin interfaceBugAnnotation- Overrides:
toStringin classBugAnnotationWithSourceLines
-
isSignificant
public boolean isSignificant()Description copied from interface:BugAnnotationIs this annotation used to compute instance hashes or match bug instances across versions- Returns:
- true if significant
-