Exemple #1
0
  /**
   * The routine which actually does the real bytecode transformation. this is public because it
   * needs to be callable from the type checker script. In normal running the javaagent is the only
   * class which has a handle on the registered transformer so it is the only one which can reach
   * this point.
   *
   * @param ruleScript the script
   * @param loader the loader of the class being injected into
   * @param className the name of the class being injected into
   * @param targetClassBytes the current class bytecode
   * @return the transformed bytecode or NULL if no transform was applied
   */
  public byte[] transform(
      RuleScript ruleScript, ClassLoader loader, String className, byte[] targetClassBytes) {
    TransformContext transformContext =
        new TransformContext(this, ruleScript, className, loader, helperManager);

    return transformContext.transform(targetClassBytes);
  }