public abstract class FieldOrMethod extends CPInstruction implements LoadClass
index
length, opcode
Modifier | Constructor and Description |
---|---|
protected |
FieldOrMethod(short opcode,
int index) |
Modifier and Type | Method and Description |
---|---|
String |
getClassName(ConstantPoolGen cpg)
Deprecated.
If the instruction references an array class,
this method will return "java.lang.Object".
For code generated by Java 1.5, this answer is
sometimes wrong (e.g., if the "clone()" method is
called on an array). A better idea is to use
the
getReferenceType(ConstantPoolGen) method, which correctly distinguishes
between class types and array types. |
ObjectType |
getClassType(ConstantPoolGen cpg)
Deprecated.
If the instruction references an array class,
the ObjectType returned will be invalid. Use
getReferenceType() instead.
|
ObjectType |
getLoadClassType(ConstantPoolGen cpg)
Gets the ObjectType of the method return or field.
|
String |
getName(ConstantPoolGen cpg) |
ReferenceType |
getReferenceType(ConstantPoolGen cpg)
Gets the reference type representing the class, interface,
or array class referenced by the instruction.
|
String |
getSignature(ConstantPoolGen cpg) |
dump, getIndex, getType, initFromFile, setIndex, toString, toString
accept, consumeStack, copy, equals, getComparator, getLength, getName, getOpcode, hashCode, isValidByte, isValidShort, produceStack, readInstruction, setComparator, toString
protected FieldOrMethod(short opcode, int index)
index
- to constant poolpublic String getSignature(ConstantPoolGen cpg)
public String getName(ConstantPoolGen cpg)
@Deprecated public String getClassName(ConstantPoolGen cpg)
getReferenceType(ConstantPoolGen)
method, which correctly distinguishes
between class types and array types.@Deprecated public ObjectType getClassType(ConstantPoolGen cpg)
public ReferenceType getReferenceType(ConstantPoolGen cpg)
cpg
- the ConstantPoolGen used to create the instructionpublic ObjectType getLoadClassType(ConstantPoolGen cpg)
getLoadClassType
in interface LoadClass
ClassGenException
- when the field is (or method returns) an array,Copyright © 2004–2019 The Apache Software Foundation. All rights reserved.