Class JavassistClassBytecodeProcessor

java.lang.Object
org.zeroturnaround.javarebel.integration.support.JavassistClassBytecodeProcessor
All Implemented Interfaces:
org.zeroturnaround.javarebel.ClassBytecodeProcessor
Direct Known Subclasses:
CacheAwareJavassistClassBytecodeProcessor, CBPs.DelayedProcessor

public abstract class JavassistClassBytecodeProcessor extends Object implements org.zeroturnaround.javarebel.ClassBytecodeProcessor
Javassist-based bytecode processor callback.

Any sub class is required to implement the process(ClassPool, ClassLoader, CtClass) method.

  • Constructor Details

    • JavassistClassBytecodeProcessor

      public JavassistClassBytecodeProcessor()
  • Method Details

    • process

      public byte[] process(ClassLoader cl, String name, byte[] bytecode)
      Specified by:
      process in interface org.zeroturnaround.javarebel.ClassBytecodeProcessor
    • priority

      public int priority()
      Specified by:
      priority in interface org.zeroturnaround.javarebel.ClassBytecodeProcessor
    • process

      protected byte[] process(org.zeroturnaround.bundled.javassist.ClassPool cp, ClassLoader cl, String classname, byte[] bytecode) throws Exception
      Throws:
      Exception
    • setImplicitClassNames

      public void setImplicitClassNames(Map<String,String> implicitClassNames)
      Can modify the class name request from javassist. Used to improve performance to skip pointless name checks.
    • acceptPathAsClass

      public boolean acceptPathAsClass(String classname)
      Says to javassist if the path can even be a class name. Used to improve performance to skip pointless name checks.
    • acceptPathAsPrimitive

      public boolean acceptPathAsPrimitive(String classname)
    • process

      public abstract void process(org.zeroturnaround.bundled.javassist.ClassPool cp, ClassLoader cl, org.zeroturnaround.bundled.javassist.CtClass ctClass) throws Exception
      Modifies the class to be loaded.
      Parameters:
      cp - the container of CtClass objects.
      cl - the class loader loading the given class.
      ctClass - the class representation.
      Throws:
      Exception
    • withDuplicatePatchingProtection

      public JavassistClassBytecodeProcessor withDuplicatePatchingProtection()
      Avoids duplicate patching a given class when it has already been patched. The mechanism for checking this is to add a field to the class with a comma-separated list of CBP names that have been applied to the class and to check this list for a match before running the cbp.