Class BootstrapMethodsAttribute
java.lang.Object
javassist.bytecode.AttributeInfo
javassist.bytecode.BootstrapMethodsAttribute
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn element ofbootstrap_methods. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a BootstrapMethods attribute. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMethod(ConstPool srcCp, BootstrapMethodsAttribute.BootstrapMethod srcBm, int index, Map<String, String> classnames) add bootstrap method from givenConstPoolandBootstrapMethod, and add it to the specified index.Makes a copy.Obtainsbootstrap_methodsin this attribute.Methods inherited from class AttributeInfo
get, getConstPool, getName, length, set, setMaxAttributeLength
-
Field Details
-
tag
-
-
Constructor Details
-
BootstrapMethodsAttribute
Constructs a BootstrapMethods attribute.- Parameters:
cp- a constant pool table.methods- the contents.
-
-
Method Details
-
getMethods
Obtainsbootstrap_methodsin 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
Makes a copy. Class names are replaced according to the givenMapobject.- Overrides:
copyin classAttributeInfo- 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 givenConstPoolandBootstrapMethod, and add it to the specified index. Class names are replaced according to the givenMapobject.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 newBootstrapMethod srcBm;
if the index equals to the origin method length, then append the newBootstrapMethod srcBmat the origin methods tail.- Parameters:
srcCp- the constant pool table of source.srcBm- the bootstrap method of sourceindex- the new method index on bootstrap methodsclassnames- pairs of replaced and substituted class names.
-