Class BootstrapMethodsAttribute

java.lang.Object
javassist.bytecode.AttributeInfo
javassist.bytecode.BootstrapMethodsAttribute

public class BootstrapMethodsAttribute extends AttributeInfo
  • Field Details

  • Constructor Details

  • Method Details

    • getMethods

      Obtains bootstrap_methods in this attribute.
      Returns:
      an array of BootstrapMethod. Since it is a fresh copy, modifying the returned array does not affect the original contents of this attribute.
    • copy

      public AttributeInfo copy(ConstPool newCp, Map<String,String> classnames)
      Makes a copy. Class names are replaced according to the given Map object.
      Overrides:
      copy in class AttributeInfo
      Parameters:
      newCp - the constant pool table used by the new copy.
      classnames - pairs of replaced and substituted class names.
    • addMethod

      public void addMethod(ConstPool srcCp, BootstrapMethodsAttribute.BootstrapMethod srcBm, int index, Map<String,String> classnames)
      add bootstrap method from given ConstPool and BootstrapMethod, and add it to the specified index. Class names are replaced according to the given Map object.

      if the index less than 0 or large than the origin method length, then throw RuntimeException;
      if the index large or equals to 0 and less or equals to the origin method length, then replace the origin method with the new BootstrapMethod srcBm ;
      if the index equals to the origin method length, then append the new BootstrapMethod srcBm at the origin methods tail.

      Parameters:
      srcCp - the constant pool table of source.
      srcBm - the bootstrap method of source
      index - the new method index on bootstrap methods
      classnames - pairs of replaced and substituted class names.
    • convertMethodsToBytes

      private static byte[] convertMethodsToBytes(BootstrapMethodsAttribute.BootstrapMethod[] methods)