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, sourceLines
Fields inherited from interface edu.umd.cs.findbugs.BugAnnotation
MESSAGE_TAG
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
PackageMemberAnnotation
(String className, String description) Constructor.protected
PackageMemberAnnotation
(String className, String description, String sourceFileName) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal String
format
(String key, ClassAnnotation primaryClass) Format the annotation.protected abstract String
formatPackageMember
(String key, ClassAnnotation primaryClass) Do default and subclass-specific formatting.final ClassDescriptor
Get the class descriptor.final String
Get the dotted class name.Get a description of this bug annotation.final String
Get the package name.final String
Get the dotted class name.boolean
Is this annotation used to compute instance hashes or match bug instances across versionsprotected static String
removePackage
(String typeName) protected static String
removePackageName
(String typeName) Shorten a type name by removing the package namevoid
setDescription
(String description) Set a description of this bug annotation.protected static String
Shorten 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, setSourceLines
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.umd.cs.findbugs.BugAnnotation
accept
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface edu.umd.cs.findbugs.xml.XMLWriteable
writeXML
Methods 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:BugAnnotation
Set a description of this bug annotation. The description is a key for the FindBugsAnnotationDescriptions resource bundle. -
getDescription
Description copied from interface:BugAnnotation
Get 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.lang
package. -
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:
toString
in interfaceBugAnnotation
- Overrides:
toString
in classBugAnnotationWithSourceLines
-
isSignificant
public boolean isSignificant()Description copied from interface:BugAnnotation
Is this annotation used to compute instance hashes or match bug instances across versions- Returns:
- true if significant
-