org.aspectj.weaver.bcel.asm
Class StackMapAdder

java.lang.Object
  extended by org.aspectj.weaver.bcel.asm.StackMapAdder

public class StackMapAdder
extends java.lang.Object

Uses asm to add the stack map attribute to methods in a class. The class is passed in as pure byte data and then a reader/writer process it. The writer is wired into the world so that types can be resolved and getCommonSuperClass() can be implemented without class loading using the context class loader. It is important that the constant pool is preserved here and asm does not try to remove unused entries. That is because some entries are refered to from classfile attributes. Asm cannot see into these attributes so does not realise the constant pool entries are in use. In order to ensure the copying of cp occurs, we use the variant super constructor call in AspectJConnectClassWriter that passes in the classreader. However, ordinarily that change causes a further optimization: that if a classreader sees a methodvisitor that has been created by a ClassWriter then it just copies the data across without changing it (and so it fails to attach the stackmapattribute). In order to avoid this further optimization we use our own minimal MethodVisitor.


Constructor Summary
StackMapAdder()
           
 
Method Summary
static byte[] addStackMaps(World world, byte[] data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackMapAdder

public StackMapAdder()
Method Detail

addStackMaps

public static byte[] addStackMaps(World world,
                                  byte[] data)