| java.lang.Object org.ejb3unit.asm.MethodAdapter org.ejb3unit.asm.util.CheckMethodAdapter
CheckMethodAdapter | public class CheckMethodAdapter extends MethodAdapter (Code) | | A
MethodAdapter that checks that its methods are properly used. More
precisely this code adapter checks each instruction individually (i.e., each
visit method checks some preconditions based only on its arguments -
such as the fact that the given opcode is correct for a given visit method),
but does not check the sequence of instructions. For example,
in a method whose signature is void m (), the invalid instruction
IRETURN, or the invalid sequence IADD L2I will not be detected by
this code adapter.
author: Eric Bruneton |
Method Summary | |
static void | checkConstant(Object cst) Checks that the given value is an
Integer , a
Float , a
Long , a
Double or a
String . | static void | checkDesc(String desc, boolean canBeVoid) Checks that the given string is a valid type descriptor. | static int | checkDesc(String desc, int start, boolean canBeVoid) Checks that a the given substring is a valid type descriptor.
Parameters: desc - the string to be checked. Parameters: start - index of the first character of the identifier (inclusive). Parameters: canBeVoid - true if V can be considered valid. | void | checkEndCode() Checks that the visitMaxs method has not been called. | void | checkEndMethod() Checks that the visitEnd method has not been called. | static void | checkIdentifier(String name, String msg) Checks that the given string is a valid Java identifier. | static void | checkIdentifier(String name, int start, int end, String msg) Checks that the given substring is a valid Java identifier.
Parameters: name - the string to be checked. Parameters: start - index of the first character of the identifier (inclusive). Parameters: end - index of the last character of the identifier (exclusive). | static void | checkInternalName(String name, String msg) Checks that the given string is a valid internal class name. | static void | checkInternalName(String name, int start, int end, String msg) Checks that the given substring is a valid internal class name.
Parameters: name - the string to be checked. Parameters: start - index of the first character of the identifier (inclusive). Parameters: end - index of the last character of the identifier (exclusive). | void | checkLabel(Label label, boolean checkVisited, String msg) Checks that the given label is not null. | static void | checkMethodDesc(String desc) Checks that the given string is a valid method descriptor. | static void | checkMethodIdentifier(String name, String msg) Checks that the given string is a valid Java identifier or is equal to
'<init>' or '<clinit>'. | static void | checkOpcode(int opcode, int type) Checks that the type of the given opcode is equal to the given type. | static void | checkSignedByte(int value, String msg) Checks that the given value is a signed byte. | static void | checkSignedShort(int value, String msg) Checks that the given value is a signed short. | void | checkStartCode() Checks that the visitCode method has been called. | static void | checkUnsignedShort(int value, String msg) Checks that the given value is an unsigned short. | public AnnotationVisitor | visitAnnotation(String desc, boolean visible) | public AnnotationVisitor | visitAnnotationDefault() | public void | visitAttribute(Attribute attr) | public void | visitCode() | public void | visitEnd() | public void | visitFieldInsn(int opcode, String owner, String name, String desc) | public void | visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) | public void | visitIincInsn(int var, int increment) | public void | visitInsn(int opcode) | public void | visitIntInsn(int opcode, int operand) | public void | visitJumpInsn(int opcode, Label label) | public void | visitLabel(Label label) | public void | visitLdcInsn(Object cst) | public void | visitLineNumber(int line, Label start) | public void | visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) | public void | visitLookupSwitchInsn(Label dflt, int keys, Label labels) | public void | visitMaxs(int maxStack, int maxLocals) | public void | visitMethodInsn(int opcode, String owner, String name, String desc) | public void | visitMultiANewArrayInsn(String desc, int dims) | public AnnotationVisitor | visitParameterAnnotation(int parameter, String desc, boolean visible) | public void | visitTableSwitchInsn(int min, int max, Label dflt, Label labels) | public void | visitTryCatchBlock(Label start, Label end, Label handler, String type) | public void | visitTypeInsn(int opcode, String desc) | public void | visitVarInsn(int opcode, int var) |
CheckMethodAdapter | public CheckMethodAdapter(MethodVisitor cv)(Code) | | Constructs a new
CheckMethodAdapter object.
Parameters: cv - the code visitor to which this adapter must delegate calls. |
checkDesc | static void checkDesc(String desc, boolean canBeVoid)(Code) | | Checks that the given string is a valid type descriptor.
Parameters: desc - the string to be checked. Parameters: canBeVoid - true if V can be considered valid. |
checkDesc | static int checkDesc(String desc, int start, boolean canBeVoid)(Code) | | Checks that a the given substring is a valid type descriptor.
Parameters: desc - the string to be checked. Parameters: start - index of the first character of the identifier (inclusive). Parameters: canBeVoid - true if V can be considered valid. the index of the last character of the type decriptor, plus one. |
checkEndCode | void checkEndCode()(Code) | | Checks that the visitMaxs method has not been called.
|
checkEndMethod | void checkEndMethod()(Code) | | Checks that the visitEnd method has not been called.
|
checkIdentifier | static void checkIdentifier(String name, String msg)(Code) | | Checks that the given string is a valid Java identifier.
Parameters: name - the string to be checked. Parameters: msg - a message to be used in case of error. |
checkIdentifier | static void checkIdentifier(String name, int start, int end, String msg)(Code) | | Checks that the given substring is a valid Java identifier.
Parameters: name - the string to be checked. Parameters: start - index of the first character of the identifier (inclusive). Parameters: end - index of the last character of the identifier (exclusive). -1is equivalent to name.length() if name is notnull. Parameters: msg - a message to be used in case of error. |
checkInternalName | static void checkInternalName(String name, String msg)(Code) | | Checks that the given string is a valid internal class name.
Parameters: name - the string to be checked. Parameters: msg - a message to be used in case of error. |
checkInternalName | static void checkInternalName(String name, int start, int end, String msg)(Code) | | Checks that the given substring is a valid internal class name.
Parameters: name - the string to be checked. Parameters: start - index of the first character of the identifier (inclusive). Parameters: end - index of the last character of the identifier (exclusive). -1is equivalent to name.length() if name is notnull. Parameters: msg - a message to be used in case of error. |
checkLabel | void checkLabel(Label label, boolean checkVisited, String msg)(Code) | | Checks that the given label is not null. This method can also check that
the label has been visited.
Parameters: label - the label to be checked. Parameters: checkVisited - true to check that the label has beenvisited. Parameters: msg - a message to be used in case of error. |
checkMethodDesc | static void checkMethodDesc(String desc)(Code) | | Checks that the given string is a valid method descriptor.
Parameters: desc - the string to be checked. |
checkMethodIdentifier | static void checkMethodIdentifier(String name, String msg)(Code) | | Checks that the given string is a valid Java identifier or is equal to
'<init>' or '<clinit>'.
Parameters: name - the string to be checked. Parameters: msg - a message to be used in case of error. |
checkOpcode | static void checkOpcode(int opcode, int type)(Code) | | Checks that the type of the given opcode is equal to the given type.
Parameters: opcode - the opcode to be checked. Parameters: type - the expected opcode type. |
checkSignedByte | static void checkSignedByte(int value, String msg)(Code) | | Checks that the given value is a signed byte.
Parameters: value - the value to be checked. Parameters: msg - an message to be used in case of error. |
checkSignedShort | static void checkSignedShort(int value, String msg)(Code) | | Checks that the given value is a signed short.
Parameters: value - the value to be checked. Parameters: msg - an message to be used in case of error. |
checkStartCode | void checkStartCode()(Code) | | Checks that the visitCode method has been called.
|
checkUnsignedShort | static void checkUnsignedShort(int value, String msg)(Code) | | Checks that the given value is an unsigned short.
Parameters: value - the value to be checked. Parameters: msg - an message to be used in case of error. |
visitCode | public void visitCode()(Code) | | |
visitEnd | public void visitEnd()(Code) | | |
visitFrame | public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack)(Code) | | |
visitIincInsn | public void visitIincInsn(int var, int increment)(Code) | | |
visitInsn | public void visitInsn(int opcode)(Code) | | |
visitIntInsn | public void visitIntInsn(int opcode, int operand)(Code) | | |
visitJumpInsn | public void visitJumpInsn(int opcode, Label label)(Code) | | |
visitLineNumber | public void visitLineNumber(int line, Label start)(Code) | | |
visitLookupSwitchInsn | public void visitLookupSwitchInsn(Label dflt, int keys, Label labels)(Code) | | |
visitMaxs | public void visitMaxs(int maxStack, int maxLocals)(Code) | | |
visitMultiANewArrayInsn | public void visitMultiANewArrayInsn(String desc, int dims)(Code) | | |
visitTableSwitchInsn | public void visitTableSwitchInsn(int min, int max, Label dflt, Label labels)(Code) | | |
visitTypeInsn | public void visitTypeInsn(int opcode, String desc)(Code) | | |
visitVarInsn | public void visitVarInsn(int opcode, int var)(Code) | | |
Methods inherited from org.ejb3unit.asm.MethodAdapter | public AnnotationVisitor visitAnnotation(String desc, boolean visible)(Code)(Java Doc) public AnnotationVisitor visitAnnotationDefault()(Code)(Java Doc) public void visitAttribute(Attribute attr)(Code)(Java Doc) public void visitCode()(Code)(Java Doc) public void visitEnd()(Code)(Java Doc) public void visitFieldInsn(int opcode, String owner, String name, String desc)(Code)(Java Doc) public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack)(Code)(Java Doc) public void visitIincInsn(int var, int increment)(Code)(Java Doc) public void visitInsn(int opcode)(Code)(Java Doc) public void visitIntInsn(int opcode, int operand)(Code)(Java Doc) public void visitJumpInsn(int opcode, Label label)(Code)(Java Doc) public void visitLabel(Label label)(Code)(Java Doc) public void visitLdcInsn(Object cst)(Code)(Java Doc) public void visitLineNumber(int line, Label start)(Code)(Java Doc) public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index)(Code)(Java Doc) public void visitLookupSwitchInsn(Label dflt, int keys, Label labels)(Code)(Java Doc) public void visitMaxs(int maxStack, int maxLocals)(Code)(Java Doc) public void visitMethodInsn(int opcode, String owner, String name, String desc)(Code)(Java Doc) public void visitMultiANewArrayInsn(String desc, int dims)(Code)(Java Doc) public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible)(Code)(Java Doc) public void visitTableSwitchInsn(int min, int max, Label dflt, Label labels)(Code)(Java Doc) public void visitTryCatchBlock(Label start, Label end, Label handler, String type)(Code)(Java Doc) public void visitTypeInsn(int opcode, String desc)(Code)(Java Doc) public void visitVarInsn(int opcode, int var)(Code)(Java Doc)
|
|
|