Package serp.bytecode
Class LocalVariableTable
- java.lang.Object
-
- serp.bytecode.Attributes
-
- serp.bytecode.Attribute
-
- serp.bytecode.LocalTable
-
- serp.bytecode.LocalVariableTable
-
- All Implemented Interfaces:
BCEntity,InstructionPtr,VisitAcceptor
public class LocalVariableTable extends LocalTable
Code blocks compiled from source have local variable tables mapping locals used in opcodes to their names and descriptions.- Author:
- Abe White
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptVisit(BCVisitor visit)Accept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.LocalVariableaddLocalVariable()Add a local to this table.LocalVariableaddLocalVariable(java.lang.String name, java.lang.Class type)Add a local to this table.LocalVariableaddLocalVariable(java.lang.String name, java.lang.String type)Add a local to this table.LocalVariableaddLocalVariable(java.lang.String name, BCClass type)Add a local to this table.LocalVariableaddLocalVariable(LocalVariable local)Import a local from another method/class.LocalVariablegetLocalVariable(int local)Return the local with the given locals index, or null if none.LocalVariablegetLocalVariable(java.lang.String name)Return the local with the given name, or null if none.LocalVariable[]getLocalVariables()Return all the locals of this method.LocalVariable[]getLocalVariables(java.lang.String name)Return all locals with the given name, or empty array if none.protected LocalnewLocal()Create a new element of this table.protected Local[]newLocalArray(int size)Create a new array.-
Methods inherited from class serp.bytecode.LocalTable
addLocal, addLocal, addLocal, clear, getCode, getLocal, getLocal, getLocals, getLocals, removeLocal, removeLocal, removeLocal, replaceTarget, setLocals, updateTargets
-
Methods inherited from class serp.bytecode.Attribute
getClassLoader, getName, getNameIndex, getOwner, getPool, getProject, isValid
-
Methods inherited from class serp.bytecode.Attributes
addAttribute, addAttribute, clearAttributes, getAttribute, getAttributes, getAttributes, removeAttribute, removeAttribute, setAttributes
-
-
-
-
Method Detail
-
getLocalVariables
public LocalVariable[] getLocalVariables()
Return all the locals of this method.
-
getLocalVariable
public LocalVariable getLocalVariable(int local)
Return the local with the given locals index, or null if none.
-
getLocalVariable
public LocalVariable getLocalVariable(java.lang.String name)
Return the local with the given name, or null if none. If multiple locals have the given name, which is returned is undefined.
-
getLocalVariables
public LocalVariable[] getLocalVariables(java.lang.String name)
Return all locals with the given name, or empty array if none.
-
addLocalVariable
public LocalVariable addLocalVariable(LocalVariable local)
Import a local from another method/class. Note that the program counter and length from the given local is copied directly, and thus will be incorrect unless this method is the same as the one the local is copied from, or the pc and length are reset.
-
addLocalVariable
public LocalVariable addLocalVariable()
Add a local to this table.
-
addLocalVariable
public LocalVariable addLocalVariable(java.lang.String name, java.lang.String type)
Add a local to this table.
-
addLocalVariable
public LocalVariable addLocalVariable(java.lang.String name, java.lang.Class type)
Add a local to this table.
-
addLocalVariable
public LocalVariable addLocalVariable(java.lang.String name, BCClass type)
Add a local to this table.
-
acceptVisit
public void acceptVisit(BCVisitor visit)
Description copied from interface:VisitAcceptorAccept a visit from aBCVisitor, calling the appropriate methods to notify the visitor that it has entered this entity, and to provide it with the proper callbacks for each sub-entity owned by this one.
-
newLocal
protected Local newLocal()
Description copied from class:LocalTableCreate a new element of this table.- Specified by:
newLocalin classLocalTable
-
newLocalArray
protected Local[] newLocalArray(int size)
Description copied from class:LocalTableCreate a new array.- Specified by:
newLocalArrayin classLocalTable
-
-