org.glassfish.pfl.tf.tools.enhancer
Class Transformer

java.lang.Object
  extended by org.glassfish.pfl.tf.tools.enhancer.Transformer
All Implemented Interfaces:
org.glassfish.pfl.basic.func.UnaryFunction<byte[],byte[]>

public class Transformer
extends Object
implements org.glassfish.pfl.basic.func.UnaryFunction<byte[],byte[]>

ClassFile enhancer for the tracing facility. This modifies the bytecode for an applicable class, then returns the updated bytecode. Makes extensive use of the ASM library. This is split into two parts. The first part modifies the schema of the class as follows:

The second part modifies the MM annotated methods as follows:

  • Adds a preamble to set up some local variables, and to call the MethodMonitor.enter method when active.
  • Adds a finally block at the end of the method that handles calling MethodMonitor.exit whenever an exception is thrown or propagated from the body of the method.
  • Modifies all exit point in the method as follows:

    Note that the second part could be run in a ClassFileTransformer or ClassLoader if desired, since this design enhances the class files in place for the first part.

    Author:
    ken

    Method Summary
     byte[] evaluate(byte[] arg)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Method Detail

    evaluate

    public byte[] evaluate(byte[] arg)
    Specified by:
    evaluate in interface org.glassfish.pfl.basic.func.UnaryFunction<byte[],byte[]>


    Copyright © 2013 Oracle. All Rights Reserved.