|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.SourceLineAnnotation
public class SourceLineAnnotation
A BugAnnotation that records a range of source lines in a class.
BugAnnotation
Field Summary | |
---|---|
private java.lang.String |
className
|
private static java.lang.String |
DEFAULT_ROLE
|
private java.lang.String |
description
|
private static java.lang.String |
ELEMENT_NAME
|
private int |
endBytecode
|
private int |
endLine
|
private java.lang.String |
sourceFile
|
private int |
startBytecode
|
private int |
startLine
|
static java.lang.String |
UNKNOWN_SOURCE_FILE
String returned if the source file is unknown. |
Constructor Summary | |
---|---|
SourceLineAnnotation(java.lang.String className,
java.lang.String sourceFile,
int startLine,
int endLine,
int startBytecode,
int endBytecode)
Constructor. |
Method Summary | |
---|---|
void |
accept(BugAnnotationVisitor visitor)
Accept a BugAnnotationVisitor. |
private void |
appendLines(java.lang.StringBuffer buf)
|
int |
compareTo(BugAnnotation o)
|
static SourceLineAnnotation |
createUnknown(java.lang.String className,
java.lang.String sourceFile)
Factory method to create an unknown source line annotation. |
static SourceLineAnnotation |
createUnknown(java.lang.String className,
java.lang.String sourceFile,
int startBytecode,
int endBytecode)
|
boolean |
equals(java.lang.Object o)
|
private static SourceLineAnnotation |
forEntireMethod(java.lang.String className,
java.lang.String sourceFile,
org.apache.bcel.classfile.LineNumberTable lineNumberTable,
int codeSize)
|
java.lang.String |
format(java.lang.String key)
Format the annotation as a String. |
static SourceLineAnnotation |
fromVisitedInstruction(DismantleBytecode visitor)
Factory method for creating a source line annotation describing the source line number for the instruction being visited by given visitor. |
static SourceLineAnnotation |
fromVisitedInstruction(org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile,
org.apache.bcel.generic.InstructionHandle handle)
Factory method for creating a source line annotation describing the source line number for a visited instruction. |
static SourceLineAnnotation |
fromVisitedInstruction(PreorderVisitor visitor,
int pc)
Factory method for creating a source line annotation describing the source line number for the instruction being visited by given visitor. |
static SourceLineAnnotation |
fromVisitedInstructionRange(org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile,
org.apache.bcel.generic.InstructionHandle start,
org.apache.bcel.generic.InstructionHandle end)
Factory method for creating a source line annotation describing the source line numbers for a range of instruction in a method. |
static SourceLineAnnotation |
fromVisitedInstructionRange(PreorderVisitor visitor,
int startPC,
int endPC)
Factory method for creating a source line annotation describing the source line numbers for a range of instructions in the method being visited by the given visitor. |
static SourceLineAnnotation |
fromVisitedMethod(org.apache.bcel.generic.MethodGen methodGen,
java.lang.String sourceFile)
Factory method for creating a source line annotation describing an entire method. |
static SourceLineAnnotation |
fromVisitedMethod(PreorderVisitor visitor)
Factory method for creating a source line annotation describing an entire method. |
java.lang.String |
getClassName()
Get the class name. |
java.lang.String |
getDescription()
Get a description of this bug annotation. |
int |
getEndBytecode()
Get end bytecode (inclusive). |
int |
getEndLine()
Get the ending line (inclusive). |
private static org.apache.bcel.classfile.LineNumberTable |
getLineNumberTable(PreorderVisitor visitor)
|
java.lang.String |
getPackageName()
Get the package name. |
java.lang.String |
getSourceFile()
Get the source file name. |
int |
getStartBytecode()
Get start bytecode (inclusive). |
int |
getStartLine()
Get the start line (inclusive). |
int |
hashCode()
|
boolean |
isSourceFileKnown()
Is the source file known? |
boolean |
isUnknown()
Is this an unknown source line annotation? |
void |
setDescription(java.lang.String description)
Set a description of this bug annotation. |
void |
setSourceFile(java.lang.String sourceFile)
Set the source file name. |
java.lang.String |
toString()
|
void |
writeXML(XMLOutput xmlOutput)
Write this object to given XMLOutput. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String DEFAULT_ROLE
public static final java.lang.String UNKNOWN_SOURCE_FILE
private java.lang.String description
private java.lang.String className
private java.lang.String sourceFile
private int startLine
private int endLine
private int startBytecode
private int endBytecode
private static final java.lang.String ELEMENT_NAME
Constructor Detail |
---|
public SourceLineAnnotation(java.lang.String className, java.lang.String sourceFile, int startLine, int endLine, int startBytecode, int endBytecode)
className
- the class to which the line number(s) refersourceFile
- the name of the source filestartLine
- the first line (inclusive)endLine
- the ending line (inclusive)startBytecode
- the first bytecode offset (inclusive)endBytecode
- the end bytecode offset (inclusive)Method Detail |
---|
public static SourceLineAnnotation createUnknown(java.lang.String className, java.lang.String sourceFile)
className
- the class name
public static SourceLineAnnotation createUnknown(java.lang.String className, java.lang.String sourceFile, int startBytecode, int endBytecode)
public static SourceLineAnnotation fromVisitedMethod(PreorderVisitor visitor)
visitor
- a BetterVisitor which is visiting the method
public static SourceLineAnnotation fromVisitedMethod(org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile)
methodGen
- the method being visited
private static SourceLineAnnotation forEntireMethod(java.lang.String className, java.lang.String sourceFile, org.apache.bcel.classfile.LineNumberTable lineNumberTable, int codeSize)
public static SourceLineAnnotation fromVisitedInstruction(PreorderVisitor visitor, int pc)
visitor
- a BetterVisitor which is visiting the methodpc
- the bytecode offset of the instruction in the method
public static SourceLineAnnotation fromVisitedInstructionRange(PreorderVisitor visitor, int startPC, int endPC)
visitor
- a BetterVisitor which is visiting the methodstartPC
- the bytecode offset of the start instruction in the rangeendPC
- the bytecode offset of the end instruction in the range
public static SourceLineAnnotation fromVisitedInstruction(DismantleBytecode visitor)
visitor
- a DismantleBytecode visitor which is visiting the method
public static SourceLineAnnotation fromVisitedInstruction(org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile, org.apache.bcel.generic.InstructionHandle handle)
methodGen
- the MethodGen object representing the methodhandle
- the InstructionHandle containing the visited instruction
public static SourceLineAnnotation fromVisitedInstructionRange(org.apache.bcel.generic.MethodGen methodGen, java.lang.String sourceFile, org.apache.bcel.generic.InstructionHandle start, org.apache.bcel.generic.InstructionHandle end)
methodGen
- the methodstart
- the start instructionend
- the end instruction (inclusive)private static org.apache.bcel.classfile.LineNumberTable getLineNumberTable(PreorderVisitor visitor)
public java.lang.String getClassName()
public java.lang.String getSourceFile()
public boolean isSourceFileKnown()
public void setSourceFile(java.lang.String sourceFile)
sourceFile
- the source file namepublic java.lang.String getPackageName()
public int getStartLine()
public int getEndLine()
public int getStartBytecode()
public int getEndBytecode()
public boolean isUnknown()
public void accept(BugAnnotationVisitor visitor)
BugAnnotation
accept
in interface BugAnnotation
visitor
- the visitor to acceptpublic java.lang.String format(java.lang.String key)
BugAnnotation
format
in interface BugAnnotation
key
- how the annotation should be formattedprivate void appendLines(java.lang.StringBuffer buf)
public java.lang.String getDescription()
BugAnnotation
getDescription
in interface BugAnnotation
public void setDescription(java.lang.String description)
BugAnnotation
setDescription
in interface BugAnnotation
public java.lang.String toString()
toString
in class java.lang.Object
public int compareTo(BugAnnotation o)
compareTo
in interface java.lang.Comparable<BugAnnotation>
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void writeXML(XMLOutput xmlOutput) throws java.io.IOException
XMLWriteable
writeXML
in interface XMLWriteable
xmlOutput
- the XMLOutput for the document
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |