Package serp.bytecode
Class FieldInstruction
java.lang.Object
serp.bytecode.CodeEntry
serp.bytecode.Instruction
serp.bytecode.FieldInstruction
- All Implemented Interfaces:
BCEntity
,VisitAcceptor
- Direct Known Subclasses:
GetFieldInstruction
,PutFieldInstruction
Instruction that takes as an argument a field to operate
on. Examples include
getfield, getstatic, setfield, setstatic
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
equalsInstruction
(Instruction other) FieldInstructions are equal if the field they reference is the same, or if the field of either is unset.getField()
Return the field this instruction operates on, or null if not set.Return the declaring class of the field this instruction operates on, or null if not set.Return the declaring class of the field this instruction operates on, or null if not set.Return the declaring class of the field this instruction operates on, or null if not set.int
Return the index in the classConstantPool
of theComplexEntry
describing the field to operate on.Return the name of the field this instruction operates on, or null if not set.Return the type of the field this instruction operates on, or null if not set.Return the type of the field this instruction operates on, or null if not set.Return the type of the field this instruction operates on, or null if not set.(package private) int
Return the length in bytes of this opcode, including all arguments.(package private) void
Read the arguments for this opcode from the given stream.(package private) void
read
(Instruction orig) Copy the given instruction data.Set the field this instruction operates on.Set the field this instruction operates on.Set the field this instruction operates on, for fields that are declared by the current class.Set the field this instruction operates on, for fields that are declared by the current class.Set the field this instruction operates on.Set the field this instruction operates on, for fields that are declared by the current class.Set the field this instruction operates on.Set the field this instruction operates on.setFieldDeclarer
(Class type) Set the declaring class of the field this instruction operates on.setFieldDeclarer
(String type) Set the declaring class of the field this instruction operates on.setFieldDeclarer
(BCClass type) Set the declaring class of the field this instruction operates on.setFieldIndex
(int index) Set the index in the classConstantPool
of theComplexEntry
describing the field to operate on.setFieldName
(String name) Set the name of the field this instruction operates on.setFieldType
(Class type) Set the type of the field this instruction operates on.setFieldType
(String type) Set the type of the field this instruction operates on.setFieldType
(BCClass type) Set the type of the field this instruction operates on.(package private) void
write
(DataOutput out) Write the arguments for this opcode to the given stream.Methods inherited from class serp.bytecode.Instruction
acceptVisit, getByteIndex, getClassLoader, getCode, getLineNumber, getLogicalStackChange, getName, getOpcode, getPool, getProject, getStackChange, invalidate, invalidateByteIndexes, isValid, setOpcode
-
Field Details
-
_index
private int _index
-
-
Constructor Details
-
FieldInstruction
FieldInstruction(Code owner, int opcode)
-
-
Method Details
-
getLength
int getLength()Description copied from class:Instruction
Return the length in bytes of this opcode, including all arguments. For many opcodes this method relies on an up-to-date byte index.- Overrides:
getLength
in classInstruction
-
getFieldIndex
public int getFieldIndex()Return the index in the classConstantPool
of theComplexEntry
describing the field to operate on. -
setFieldIndex
Set the index in the classConstantPool
of theComplexEntry
describing the field to operate on.- Returns:
- this instruction, for method chaining
-
getField
Return the field this instruction operates on, or null if not set. -
setField
Set the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on.- Parameters:
dec
- the full class name of the field's declaring classname
- the field nametype
- the full class name of the field type- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on, for fields that are declared by the current class.- Parameters:
name
- the field nametype
- the full class name of the field type- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on.- Parameters:
dec
- the field's declaring classname
- the field nametype
- the class of the field type- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on, for fields that are declared by the current class.- Parameters:
name
- the field nametype
- the class of the field type- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on.- Parameters:
dec
- the field's declaring classname
- the field nametype
- the class of the field type- Returns:
- this instruction, for method chaining
-
setField
Set the field this instruction operates on, for fields that are declared by the current class.- Parameters:
name
- the field nametype
- the class of the field type- Returns:
- this instruction, for method chaining
-
getFieldName
Return the name of the field this instruction operates on, or null if not set. -
setFieldName
Set the name of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
getFieldTypeName
Return the type of the field this instruction operates on, or null if not set. -
getFieldType
Return the type of the field this instruction operates on, or null if not set. -
getFieldTypeBC
Return the type of the field this instruction operates on, or null if not set. -
setFieldType
Set the type of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
setFieldType
Set the type of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
setFieldType
Set the type of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
getFieldDeclarerName
Return the declaring class of the field this instruction operates on, or null if not set. -
getFieldDeclarerType
Return the declaring class of the field this instruction operates on, or null if not set. -
getFieldDeclarerBC
Return the declaring class of the field this instruction operates on, or null if not set. -
setFieldDeclarer
Set the declaring class of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
setFieldDeclarer
Set the declaring class of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
setFieldDeclarer
Set the declaring class of the field this instruction operates on.- Returns:
- this instruction, for method chaining
-
equalsInstruction
FieldInstructions are equal if the field they reference is the same, or if the field of either is unset.- Overrides:
equalsInstruction
in classInstruction
-
read
Description copied from class:Instruction
Copy the given instruction data.- Overrides:
read
in classInstruction
-
read
Description copied from class:Instruction
Read the arguments for this opcode from the given stream. This method should be overridden by opcodes that take arguments.- Overrides:
read
in classInstruction
- Throws:
IOException
-
write
Description copied from class:Instruction
Write the arguments for this opcode to the given stream. This method should be overridden by opcodes that take arguments.- Overrides:
write
in classInstruction
- Throws:
IOException
-