Class VerifyingClassAdapter
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- com.google.monitoring.runtime.instrumentation.VerifyingClassAdapter
-
public class VerifyingClassAdapter extends org.objectweb.asm.ClassVisitor
This is a class writer that gets used in place of the existingClassWriter
, and verifies properties of the class getting written. Currently, it only checks to see if the methods are of the correct length for Java methods (<64K).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VerifyingClassAdapter.State
An enum which indicates whether the class in question is verified.
-
Constructor Summary
Constructors Constructor Description VerifyingClassAdapter(org.objectweb.asm.ClassWriter cw, byte[] original, java.lang.String className)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isVerified()
Gets the verification state of this class.byte[]
toByteArray()
Returns the byte array that contains the byte code for this class.void
visitEnd()
org.objectweb.asm.MethodVisitor
visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
In addition, the returnedMethodVisitor
will throw an exception if the method is greater than 64K in length.
-
-
-
Constructor Detail
-
VerifyingClassAdapter
public VerifyingClassAdapter(org.objectweb.asm.ClassWriter cw, byte[] original, java.lang.String className)
- Parameters:
cw
- A class writer that is wrapped by this class adapteroriginal
- the original bytecodeclassName
- the name of the class being examined.
-
-
Method Detail
-
visitMethod
public org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String signature, java.lang.String[] exceptions)
In addition, the returnedMethodVisitor
will throw an exception if the method is greater than 64K in length.- Overrides:
visitMethod
in classorg.objectweb.asm.ClassVisitor
-
visitEnd
public void visitEnd()
- Overrides:
visitEnd
in classorg.objectweb.asm.ClassVisitor
-
isVerified
public boolean isVerified()
Gets the verification state of this class.- Returns:
- true iff the class passed inspection.
-
toByteArray
public byte[] toByteArray()
Returns the byte array that contains the byte code for this class.- Returns:
- a byte array.
-
-