com.tc.object.bytecode.rwsync
Class InitMethodStrategy
java.lang.Object
com.tc.object.bytecode.rwsync.InitMethodStrategy
- All Implemented Interfaces:
- MethodStrategy
public class InitMethodStrategy
- extends java.lang.Object
- implements MethodStrategy
A strategy to process constructors of classes containing locking fields. In general the class adapter of such a class
will extend LockingClassAdapter
, and will declare a map of MethodId to MethodStrategy. Such class adapters
must call LockingClassAdapter.addLockFields()
to add the fields to the class, and must map constructor
methods to this strategy.
Method Summary |
MethodVisitor |
visitMethod(ClassVisitor cv,
java.lang.String ownerType,
java.lang.String outerType,
java.lang.String outerDesc,
int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
Instrument a method, possibly creating other methods in the process. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
InitMethodStrategy
public InitMethodStrategy()
visitMethod
public MethodVisitor visitMethod(ClassVisitor cv,
java.lang.String ownerType,
java.lang.String outerType,
java.lang.String outerDesc,
int access,
java.lang.String name,
java.lang.String desc,
java.lang.String signature,
java.lang.String[] exceptions)
- Description copied from interface:
MethodStrategy
- Instrument a method, possibly creating other methods in the process. A do-nothing implementation might look like:
visitMethod(...) {
return cv.visitMethod(access, name, desc, signature, exceptions);
}
This would delegate the visitMethod() call to the next class adapter in the chain, returning a method visitor which
could then be visited with the method's contents.
- Specified by:
visitMethod
in interface MethodStrategy
- Parameters:
cv
- a way of calling the next class adapter in the chain. Do not pass in the samed ClassVisitor that
is invoking the method strategy, or you'll recurse endlessly! Note that cv.visitMethod may be called more
than once during a single call to this method, and must return a distinct MethodVisitor instance for each
call.ownerType
- the internal type name of the class that contains the method, e.g., "org/xyz/Foo$Bar"outerType
- null if ownerType is a top-level type, or else the internal type name of its outer class e.g.
"org/xyz/Foo"outerDesc
- null if ownerType is a top-level type, or else the type descriptor of its outer class, e.g.
"Lorg/xyz/Foo;"
- Returns:
- a method visitor which can be called with the contents of the original method. Implementations must not
return null, but may return a visitor that ignores all calls.
Copyright © 2010 Terracotta, Inc.. All Rights Reserved.