java.lang.Object
org.jboss.classfilewriter.attributes.Attribute
org.jboss.classfilewriter.code.CodeAttribute
- All Implemented Interfaces:
WritableEntry
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface that can be used to override the type merging process when merging stack frames -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaaload()voidaastore()voidvoidaload(int no) voidvoidvoidassertNotWideOnStack(int position, String message) voidassertNotWideOnStack(String message) voidassertTypeOnStack(int position, StackEntryType type, String message) voidassertTypeOnStack(StackEntryType type, String message) voidastore(int no) voidathrow()voidbaload()voidbastore()voidbipush(byte value) voidmarks the end of a branch.voidcaload()voidcastore()voidvoidDo not use Descriptor format (e.g.voidd2f()voidd2i()voidd2l()voiddadd()voiddaload()voiddastore()voiddcmpg()voiddcmpl()voiddconst(double value) Adds the appropriate dconst instruction.voidddiv()voiddload(int no) voiddmul()voiddneg()voiddrem()voiddstore(int no) voiddsub()voiddup()voiddup2()voiddup2X1()voiddup2X2()voiddupX1()voiddupX2()voidexceptionBlockEnd(ExceptionHandler handler) Mark the end of an exception handler block.exceptionBlockStart(String exceptionType) Begin writing an exception handler block.voidexceptionHandlerStart(ExceptionHandler handler) Marks the current code location as the exception handler and adds the handler to the exception handler table;voidf2d()voidf2i()voidf2l()voidfadd()voidfaload()voidfastore()voidfcmpg()voidfcmpl()voidfconst(float value) Adds the appropriate fconst instruction.voidfdiv()voidfload(int no) voidfmul()voidfneg()voidfrem()voidfstore(int no) voidfsub()voidvoidvoidvoidwrites a goto instruction.voidgotoInstruction(CodeLocation location) writes a goto instruction.voidi2b()voidi2c()voidi2d()voidi2f()voidi2l()voidi2s()voidiadd()voidiaload()voidiand()voidiastore()voidiconst(int value) Adds the appropriate iconst instruction.voididiv()ifAcmpeq()voidifAcmpeq(CodeLocation location) ifAcmpne()voidifAcmpne(CodeLocation location) ifeq()voidifEq(CodeLocation location) ifge()voidifge(CodeLocation location) ifgt()voidifgt(CodeLocation location) ifIcmpeq()voidifIcmpeq(CodeLocation location) ifIcmpge()voidifIcmpge(CodeLocation location) ifIcmpgt()voidifIcmpgt(CodeLocation location) ifIcmple()voidifIcmple(CodeLocation location) ifIcmplt()voidifIcmplt(CodeLocation location) ifIcmpne()voidifIcmpne(CodeLocation location) ifle()voidifle(CodeLocation location) iflt()voidiflt(CodeLocation location) ifne()voidifne(CodeLocation location) voidifnotnull(CodeLocation location) ifnull()Jump to the given location if the reference type on the top of the stack is null.voidifnull(CodeLocation location) Jump to the given location if the reference type on the top of the stack is nullvoidiinc(int local, int amount) voidiload(int no) voidimul()voidineg()voidinstanceofInstruction(String className) voidinvokeinterface(Method method) voidinvokeinterface(String className, String methodName, String descriptor) voidinvokeinterface(String className, String methodName, String returnType, String[] parameterTypes) voidinvokespecial(Constructor<?> constructor) voidinvokespecial(Method method) voidinvokespecial(String className, String methodName, String descriptor) voidinvokespecial(String className, String methodName, String returnType, String[] parameterTypes) voidinvokestatic(Method method) voidinvokestatic(String className, String methodName, String descriptor) voidinvokestatic(String className, String methodName, String returnType, String[] parameterTypes) voidinvokevirtual(Method method) voidinvokevirtual(String className, String methodName, String descriptor) voidinvokevirtual(String className, String methodName, String returnType, String[] parameterTypes) voidior()voidirem()voidishl()voidishr()voidistore(int no) voidisub()voidiushr()voidixor()voidl2d()voidl2f()voidl2i()voidladd()voidlaload()voidland()voidlastore()voidlcmp()voidlconst(long value) Adds the appropriate lconst instruction.voidldc(float value) Adds an ldc instruction for floatvoidldc(int value) Adds an ldc instruction for an int.voidAdds an ldc instruction for a Stringvoidldc2(double value) Adds an ldc2_w instruction for doublevoidldc2(long value) Adds an ldc2_w instruction for longvoidldiv()voidlload(int no) voidlmul()voidlneg()voidGenerates the apprpriate load instruction for the given typevoidGenerates the apprpriate load instruction for the given typevoidvoidloads all parameters onto the stack.voidLoads a java.lang.Class for the given descriptor into the stack.voidlookupswitch(LookupSwitchBuilder lookupSwitchBuilder) Adds a lookup switch statementvoidlor()voidlrem()voidlshl()voidlshr()voidlstore(int no) voidlsub()voidlushr()voidlxor()mark()Gets the location object for the current location in the bytecode.voidvoidvoidmultianewarray(String arrayType, int dimensions) voidarrayType must be aClassobject that represents a primitive typevoidnewInstruction(Class<?> clazz) voidnewInstruction(String classname) voidnop()voidpop()voidpop2()voidvoidvoidvoidvoidAdds the appropriate return instruction for the methods return type.voidsaload()voidsastore()voidsetStackFrameTypeResolver(CodeAttribute.StackFrameTypeResolver stackFrameTypeResolver) voidsetupFrame(String... types) voidsipush(short value) voidswap()voidtableswitch(TableSwitchBuilder builder) voidwriteData(ByteArrayDataOutputStream stream)
-
Field Details
-
NAME
- See Also:
-
-
Constructor Details
-
CodeAttribute
-
-
Method Details
-
getStackFrameTypeResolver
-
setStackFrameTypeResolver
-
writeData
- Specified by:
writeDatain classAttribute- Throws:
IOException
-
aaload
public void aaload() -
aastore
public void aastore() -
aconstNull
public void aconstNull() -
aload
public void aload(int no) -
anewarray
-
arraylength
public void arraylength() -
astore
public void astore(int no) -
athrow
public void athrow() -
baload
public void baload() -
bastore
public void bastore() -
caload
public void caload() -
castore
public void castore() -
bipush
public void bipush(byte value) -
branchEnd
marks the end of a branch. The current stack frame is checked for compatibility with the stack frame at the branch start -
checkcast
Do not use Descriptor format (e.g. Ljava/lang/Object;), the correct form is just java/lang/Object or java.lang.Object -
checkcast
-
d2f
public void d2f() -
d2i
public void d2i() -
d2l
public void d2l() -
dadd
public void dadd() -
daload
public void daload() -
dastore
public void dastore() -
dcmpg
public void dcmpg() -
dcmpl
public void dcmpl() -
dconst
public void dconst(double value) Adds the appropriate dconst instruction. note, if the value is not 0 or 1 then ldc is used instead -
ddiv
public void ddiv() -
dload
public void dload(int no) -
dmul
public void dmul() -
dneg
public void dneg() -
drem
public void drem() -
dstore
public void dstore(int no) -
dsub
public void dsub() -
dup
public void dup() -
dupX1
public void dupX1() -
dupX2
public void dupX2() -
dup2
public void dup2() -
dup2X1
public void dup2X1() -
dup2X2
public void dup2X2() -
exceptionBlockStart
Begin writing an exception handler block. The handler is not actually persisted until exceptionHandler is called. -
exceptionBlockEnd
Mark the end of an exception handler block. The last instruction that was written will be the last instruction covered by the handler -
exceptionHandlerStart
Marks the current code location as the exception handler and adds the handler to the exception handler table; -
f2d
public void f2d() -
f2i
public void f2i() -
f2l
public void f2l() -
fadd
public void fadd() -
faload
public void faload() -
fastore
public void fastore() -
fcmpg
public void fcmpg() -
fcmpl
public void fcmpl() -
fconst
public void fconst(float value) Adds the appropriate fconst instruction. note, if the value is not 0, 1, 2 then ldc is used instead -
fdiv
public void fdiv() -
fload
public void fload(int no) -
fmul
public void fmul() -
fneg
public void fneg() -
frem
public void frem() -
fstore
public void fstore(int no) -
fsub
public void fsub() -
getfield
-
getfield
-
getstatic
-
getstatic
-
gotoInstruction
writes a goto instruction. TODO: implemented goto_w -
gotoInstruction
writes a goto instruction. TODO: implemented goto_w -
i2b
public void i2b() -
i2c
public void i2c() -
i2d
public void i2d() -
i2f
public void i2f() -
i2l
public void i2l() -
i2s
public void i2s() -
iadd
public void iadd() -
iaload
public void iaload() -
iand
public void iand() -
iastore
public void iastore() -
iconst
public void iconst(int value) Adds the appropriate iconst instruction. note, if the value is not in the range -1 to 5 ldc is written instead- Parameters:
value-
-
idiv
public void idiv() -
ifAcmpeq
-
ifAcmpeq
-
ifAcmpne
-
ifAcmpne
-
ifIcmpeq
-
ifIcmpeq
-
ifIcmpne
-
ifIcmpne
-
ifIcmplt
-
ifIcmplt
-
ifIcmple
-
ifIcmple
-
ifIcmpgt
-
ifIcmpgt
-
ifIcmpge
-
ifIcmpge
-
ifEq
-
ifeq
-
ifne
-
ifne
-
iflt
-
iflt
-
ifle
-
ifle
-
ifgt
-
ifgt
-
ifge
-
ifge
-
ifnotnull
-
ifnotnull
-
ifnull
Jump to the given location if the reference type on the top of the stack is null -
ifnull
Jump to the given location if the reference type on the top of the stack is null. TheBranchEndreturned from this method is used to set the end point to a future point in the bytecode stream -
iinc
public void iinc(int local, int amount) -
iload
public void iload(int no) -
imul
public void imul() -
ineg
public void ineg() -
instanceofInstruction
-
invokespecial
-
invokespecial
-
invokespecial
-
invokespecial
-
invokestatic
-
invokestatic
-
invokestatic
-
invokevirtual
-
invokevirtual
-
invokevirtual
-
invokeinterface
-
invokeinterface
-
invokeinterface
-
ior
public void ior() -
irem
public void irem() -
ishl
public void ishl() -
ishr
public void ishr() -
istore
public void istore(int no) -
isub
public void isub() -
iushr
public void iushr() -
ixor
public void ixor() -
l2d
public void l2d() -
l2f
public void l2f() -
l2i
public void l2i() -
ladd
public void ladd() -
laload
public void laload() -
land
public void land() -
lastore
public void lastore() -
lcmp
public void lcmp() -
lconst
public void lconst(long value) Adds the appropriate lconst instruction. note, if the value is not 0 or 1 then ldc is used instead -
ldc
public void ldc(int value) Adds an ldc instruction for an int.- Parameters:
value- The value to load
-
ldc
public void ldc(float value) Adds an ldc instruction for float -
ldc
Adds an ldc instruction for a String To load a class literal using ldc use the @{link #loadType(String)} method. -
ldc2
public void ldc2(double value) Adds an ldc2_w instruction for double -
ldc2
public void ldc2(long value) Adds an ldc2_w instruction for long -
ldiv
public void ldiv() -
lload
public void lload(int no) -
lmul
public void lmul() -
lneg
public void lneg() -
load
Generates the apprpriate load instruction for the given type- Parameters:
type- The type of variableno- local variable number
-
load
Generates the apprpriate load instruction for the given type- Parameters:
descriptor- The descriptor of the variableno- local variable number
-
loadClass
-
loadType
Loads a java.lang.Class for the given descriptor into the stack. -
lookupswitch
Adds a lookup switch statement- Parameters:
lookupSwitchBuilder-
-
lor
public void lor() -
lrem
public void lrem() -
lshl
public void lshl() -
lshr
public void lshr() -
lstore
public void lstore(int no) -
lsub
public void lsub() -
lushr
public void lushr() -
lxor
public void lxor() -
mark
Gets the location object for the current location in the bytecode. Jumps to this location will begin executing the next instruction that is written to the bytecode stream -
monitorenter
public void monitorenter() -
monitorexit
public void monitorexit() -
multianewarray
-
newInstruction
-
newInstruction
-
newarray
arrayType must be aClassobject that represents a primitive type -
nop
public void nop() -
pop
public void pop() -
pop2
public void pop2() -
putfield
-
putfield
-
putstatic
-
putstatic
-
returnInstruction
public void returnInstruction()Adds the appropriate return instruction for the methods return type. -
saload
public void saload() -
sastore
public void sastore() -
sipush
public void sipush(short value) -
swap
public void swap() -
tableswitch
-
loadMethodParameters
public void loadMethodParameters()loads all parameters onto the stack. If this method is non-static then the parameter at location 0 (i.e. this object) is not pushed. -
getStackFrames
-
setupFrame
-
getConstPool
-
assertTypeOnStack
-
assertTypeOnStack
-
assertNotWideOnStack
-
assertNotWideOnStack
-