org.codehaus.aspectwerkz.transform.inlining.weaver
Class ConstructorCallVisitor.ReplaceNewInstructionCodeAdapter
java.lang.Object
org.objectweb.asm.CodeAdapter
org.codehaus.aspectwerkz.transform.inlining.weaver.ConstructorCallVisitor.ReplaceNewInstructionCodeAdapter
- All Implemented Interfaces:
- org.objectweb.asm.CodeVisitor
- Enclosing class:
- ConstructorCallVisitor
public class ConstructorCallVisitor.ReplaceNewInstructionCodeAdapter
- extends org.objectweb.asm.CodeAdapter
Replaces 'new' instructions with a call to the compiled JoinPoint instance.
It does the following:
- remove NEW when we know (from first visit) that it matchs
- remove DUP that follows NEW
- replace INVOKESPECIAL with call to JP
- Author:
- Alexandre Vasseur
| Fields inherited from class org.objectweb.asm.CodeAdapter |
cv |
|
Method Summary |
boolean |
constructorFilter(Set definitions,
ExpressionContext ctx,
ConstructorInfo calleeConstructorInfo)
Filters out the ctor that are not eligible for transformation. |
void |
visitInsn(int opcode)
Remove the DUP instruction if we know that those were for a NEW ... |
void |
visitLabel(org.objectweb.asm.Label label)
Label |
void |
visitMethodInsn(int opcode,
String calleeClassName,
String calleeConstructorName,
String calleeConstructorDesc)
Visits INVOKESPECIAL instructions and replace them with a call to the join point when matched. |
void |
visitTypeInsn(int opcode,
String desc)
Removes the NEW when we know that the corresponding INVOKE SPECIAL is advised. |
| Methods inherited from class org.objectweb.asm.CodeAdapter |
visitAttribute, visitFieldInsn, visitIincInsn, visitIntInsn, visitJumpInsn, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMultiANewArrayInsn, visitTableSwitchInsn, visitTryCatchBlock, visitVarInsn |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConstructorCallVisitor.ReplaceNewInstructionCodeAdapter
public ConstructorCallVisitor.ReplaceNewInstructionCodeAdapter(org.objectweb.asm.CodeVisitor ca,
ClassLoader loader,
ClassInfo callerClassInfo,
String callerClassName,
String callerMethodName,
String callerMethodDesc,
gnu.trove.TIntObjectHashMap newInvocations)
- Creates a new instance.
- Parameters:
ca - loader - callerClassInfo - callerClassName - callerMethodName - callerMethodDesc -
visitLabel
public void visitLabel(org.objectweb.asm.Label label)
- Label
- Specified by:
visitLabel in interface org.objectweb.asm.CodeVisitor- Overrides:
visitLabel in class org.objectweb.asm.CodeAdapter
- Parameters:
label -
visitTypeInsn
public void visitTypeInsn(int opcode,
String desc)
- Removes the NEW when we know that the corresponding INVOKE SPECIAL is advised.
- Specified by:
visitTypeInsn in interface org.objectweb.asm.CodeVisitor- Overrides:
visitTypeInsn in class org.objectweb.asm.CodeAdapter
- Parameters:
opcode - desc -
visitInsn
public void visitInsn(int opcode)
- Remove the DUP instruction if we know that those were for a NEW ... INVOKESPECIAL that match.
- Specified by:
visitInsn in interface org.objectweb.asm.CodeVisitor- Overrides:
visitInsn in class org.objectweb.asm.CodeAdapter
- Parameters:
opcode -
visitMethodInsn
public void visitMethodInsn(int opcode,
String calleeClassName,
String calleeConstructorName,
String calleeConstructorDesc)
- Visits INVOKESPECIAL instructions and replace them with a call to the join point when matched.
- Specified by:
visitMethodInsn in interface org.objectweb.asm.CodeVisitor- Overrides:
visitMethodInsn in class org.objectweb.asm.CodeAdapter
- Parameters:
opcode - calleeClassName - calleeConstructorName - calleeConstructorDesc -
constructorFilter
public boolean constructorFilter(Set definitions,
ExpressionContext ctx,
ConstructorInfo calleeConstructorInfo)
- Filters out the ctor that are not eligible for transformation.
- Parameters:
definitions - ctx - calleeConstructorInfo -
- Returns:
- boolean true if the method should be filtered out
Copyright © 2002-2005 Jonas Bonér, Alexandre Vasseur. All Rights Reserved.