Class Location
java.lang.Object
edu.umd.cs.findbugs.ba.Location
- All Implemented Interfaces:
Comparable<Location>
A class representing a location in the CFG for a method. Essentially, it represents a static instruction, with the important caveat that CFGs have inlined JSR subroutines, meaning that a single InstructionHandle in a CFG may represent several static locations. To this end, a Location is comprised of both an InstructionHandle and the BasicBlock that contains it.
Location objects may be compared with each other using the equals() method, and may be used as keys in tree and hash maps and sets. Note that it is only valid to compare Locations produced from the same CFG.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BasicBlockprivate final org.apache.bcel.generic.InstructionHandleprivate int -
Constructor Summary
ConstructorsConstructorDescriptionLocation(@NonNull org.apache.bcel.generic.InstructionHandle handle, @NonNull BasicBlock basicBlock) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionintboolean@NonNull BasicBlockGet the basic block.static LocationgetFirstLocation(@NonNull BasicBlock basicBlock) @NonNull org.apache.bcel.generic.InstructionHandleGet the instruction handle.static LocationgetLastLocation(@NonNull BasicBlock basicBlock) inthashCode()booleanReturn whether or not the Location is positioned at the first instruction in the basic block.booleanReturn whether or not the Location is positioned at the last instruction in the basic block.toString()
-
Field Details
-
handle
private final org.apache.bcel.generic.InstructionHandle handle -
basicBlock
-
hash
private int hash
-
-
Constructor Details
-
Location
public Location(@NonNull org.apache.bcel.generic.InstructionHandle handle, @NonNull BasicBlock basicBlock) Constructor.- Parameters:
handle- the instructionbasicBlock- the basic block containing the instruction
-
-
Method Details
-
getFirstLocation
-
getLastLocation
-
getHandle
public @NonNull org.apache.bcel.generic.InstructionHandle getHandle()Get the instruction handle. -
getBasicBlock
Get the basic block. -
isFirstInstructionInBasicBlock
public boolean isFirstInstructionInBasicBlock()Return whether or not the Location is positioned at the first instruction in the basic block. -
isLastInstructionInBasicBlock
public boolean isLastInstructionInBasicBlock()Return whether or not the Location is positioned at the last instruction in the basic block. -
compareTo
- Specified by:
compareToin interfaceComparable<Location>
-
hashCode
-
equals
-
toString
-
toCompactString
- Returns:
- a compact string of the form "bb:xx", where "bb" is the basic block number and "xx" is the bytecode offset
-