org.ow2.asmdex.util
Class RegisterShiftClassAdapter

java.lang.Object
  extended by org.ow2.asmdex.ClassVisitor
      extended by org.ow2.asmdex.util.RegisterShiftClassAdapter
Direct Known Subclasses:
RegisterShiftClassAdapterExample

public class RegisterShiftClassAdapter
extends ClassVisitor

Class Adapter used to shift all the registers found in the bytecode. This is done by overriding the visitClass method of this ClassAdapter, then the visitMethod of the MethodAdapter. So that we can sub-class RegisterShiftClassAdapter easily, instantiate it and give it to the RegisterShiftApplicationAdapter, that will set it up through the setClassVisitor and setClassName methods.

Author:
Julien Névo

Field Summary
protected  java.lang.String className
          Name of the current Class.
 
Fields inherited from class org.ow2.asmdex.ClassVisitor
api, cv
 
Constructor Summary
RegisterShiftClassAdapter(int api)
          Empty constructor
 
Method Summary
 void setClassName(java.lang.String className)
          Sets the current Class name.
 void setClassVisitor(ClassVisitor cv)
          Sets the next Class Visitor.
 MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String desc, java.lang.String[] signature, java.lang.String[] exceptions)
          Visits a method of the class.
 
Methods inherited from class org.ow2.asmdex.ClassVisitor
visit, visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitOuterClass, visitSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

className

protected java.lang.String className
Name of the current Class.

Constructor Detail

RegisterShiftClassAdapter

public RegisterShiftClassAdapter(int api)
Empty constructor

Parameters:
api - api level
Method Detail

setClassVisitor

public void setClassVisitor(ClassVisitor cv)
Sets the next Class Visitor.

Parameters:
cv - the next Class Visitor.

setClassName

public void setClassName(java.lang.String className)
Sets the current Class name. It is useful to know if we need to shift the registers or not.

Parameters:
className - the current Class name.

visitMethod

public MethodVisitor visitMethod(int access,
                                 java.lang.String name,
                                 java.lang.String desc,
                                 java.lang.String[] signature,
                                 java.lang.String[] exceptions)
Description copied from class: ClassVisitor
Visits a method of the class. This method must return a new MethodVisitor instance (or null) each time it is called, i.e., it should not return a previously returned visitor.

Overrides:
visitMethod in class ClassVisitor
Parameters:
access - the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic.
name - the method's name.
desc - the method's descriptor.
signature - the field's signature. May be null if the field's type does not use generic types.
exceptions - the internal names of the method's exception classes. May be null.
Returns:
an object to visit the byte code of the method, or null if this class visitor is not interested in visiting the code of this method.