Package org.openjdk.asmtools.jasm
Class ClassData
ClassData
This is the main data structure for representing parsed class data. This structure renders directly to a class file.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classThis is a wrapper for DataOutputStream, used for debugging purposes.static classContainer holds 2 pairs of core classes: this_class, super_class, and functionality to get output file name. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) DataVectorAttr<BootstrapMethodData> (package private) CFVersion(package private) ClassData.CoreClasses(package private) MethodDataprivate static final Stringprivate final JasmEnvironment(package private) String(package private) DataVectorAttr<InnerClassData> (package private) ArrayList<MethodData> (package private) ModuleAttr(package private) String(package private) CPXAttr(package private) NestMembersAttrprivate PermittedSubclassesAttrprivate PreloadAttrprivate RecordData(package private) SourceDebugExtensionAttr(package private) AttrDataFields inherited from class org.openjdk.asmtools.jasm.MemberData
access, annotAttrInv, annotAttrVis, deprecatedAttr, pool, signatureAttr, syntheticAttr, type_annotAttrInv, type_annotAttrVis -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBootstrapMethod(BootstrapMethodData bsmData) addField(int access, ConstantPool.ConstValue_FieldRef fieldRef) addFieldIfAbsent(int access, ConstCell name, ConstCell descriptor) voidaddInnerClass(int access, ConstCell name, ConstCell innerClass, ConstCell outerClass) (package private) voidaddLocVarData(int opc, Indexer arg) voidaddNestHost(ConstCell hostClass) voidaddNestMembers(List<ConstCell> classes) voidaddPermittedSubclasses(List<ConstCell> classes) voidaddPreloads(List<ConstCell> classes) voidendClass()voidvoidendModule(ModuleAttr moduleAttr) voidprotected DataVectorprivate FieldDatagetField(ConstantPool.ConstValue_FieldRef nameAndType) private <T extends Collection<BootstrapMethodData>>
intgetFirstIndex(T collection, BootstrapMethodData bsmData) Finds first BSM data element by value in a collectionfinal voidInitializes the ClassData.final voidfinal voidinitAsPackageInfo(int access, String className) final booleanPredicate that describes if this class has an abstract flag indicating that it is the abstract class.final booleanPredicate that describes if this class has an access flag indicating that it is an interface.final booleanPredicate that describes if this class has a primitive flag indicating that it is the primitive class.private <A extends AttrData>
voiditemizeAttributes(A... attributeList) Scans all attributes that 1.LocalMethodRef(ConstCell name, ConstCell sig) LocalMethodRef(ConstValue nape) makeFieldRef(ConstCell name, ConstCell descriptor) booleanbooleanprivate <T extends DataWriter>
DataVectorpopulateAttributesList(T... attributes) booleanprivate voidbooleanvoidRejects a record: removes the record attribute if there are no componentsprotected voidvoidsetByteLimit(int bytelimit) setRecord(int where) setSourceFileAttr(ConstCell value_cpx) StartMethod(int access, ConstCell name, ConstCell sig, ArrayList exc_table) private voidRelinks BSM data (BootstrapMethod Attribute) and Constant Pool Constant_InvokeDynamic|Constant_Dynamic entries if at least one CP cell has undefined method attribute index also the method removes duplicates in BootstrapMethod Attribute if foundvoidwrite(ToolOutput toolOutput) Writes to the directory passed with -d optionvoidMethods inherited from class org.openjdk.asmtools.jasm.MemberData
addAnnotations, createPseudoMod, getDataVector, getEnvironment, getPool, setSignatureAttr
-
Field Details
-
DEFAULT_EXTENSION
- See Also:
-
environment
-
cdos
-
fileExtension
String fileExtension -
curMethod
MethodData curMethod -
cfv
CFVersion cfv -
myClassName
String myClassName -
coreClasses
ClassData.CoreClasses coreClasses -
sourceFileAttr
AttrData sourceFileAttr -
sourceDebugExtensionAttr
SourceDebugExtensionAttr sourceDebugExtensionAttr -
interfaces
-
fields
-
methods
ArrayList<MethodData> methods -
innerClasses
DataVectorAttr<InnerClassData> innerClasses -
bootstrapMethodsAttr
DataVectorAttr<BootstrapMethodData> bootstrapMethodsAttr -
nestHostAttr
CPXAttr nestHostAttr -
nestMembersAttr
NestMembersAttr nestMembersAttr -
moduleAttribute
ModuleAttr moduleAttribute -
recordData
-
permittedSubclassesAttr
-
preloadAttr
-
-
Constructor Details
-
ClassData
- Parameters:
environment- The error reporting environment.cfv- Class file version
-
-
Method Details
-
init
public final void init(int access, ConstCell<?> this_class, ConstCell<?> super_class, ArrayList<Indexer> interfaces) Initializes the ClassData.- Parameters:
this_class- The constant pool reference to this classsuper_class- The constant pool reference to the super classinterfaces- A list of interfaces that this class implements
-
initAsPackageInfo
-
initAsModule
public final void initAsModule() -
isInterface
public final boolean isInterface()Predicate that describes if this class has an access flag indicating that it is an interface.- Returns:
- True if the classes access flag indicates it is an interface.
-
isPrimitive
public final boolean isPrimitive()Predicate that describes if this class has a primitive flag indicating that it is the primitive class.- Returns:
- True if the classes access flag indicates it is the primitive class.
-
isAbstract
public final boolean isAbstract()Predicate that describes if this class has an abstract flag indicating that it is the abstract class.- Returns:
- True if the classes access flag indicates it is the abstract class.
-
relinkBootstrapMethods
protected void relinkBootstrapMethods() -
getFirstIndex
private <T extends Collection<BootstrapMethodData>> int getFirstIndex(T collection, BootstrapMethodData bsmData) Finds first BSM data element by value in a collection -
uniquifyBootstrapMethods
private void uniquifyBootstrapMethods()Relinks BSM data (BootstrapMethod Attribute) and Constant Pool Constant_InvokeDynamic|Constant_Dynamic entries if at least one CP cell has undefined method attribute index also the method removes duplicates in BootstrapMethod Attribute if found -
setSourceFileAttr
-
setSourceDebugExtensionAttr
-
setRecord
-
rejectRecord
public void rejectRecord()Rejects a record: removes the record attribute if there are no components -
makeFieldRef
-
addFieldIfAbsent
-
getField
-
addField
-
addField
-
StartMethod
-
EndMethod
public void EndMethod() -
LocalMethodRef
-
LocalMethodRef
-
addLocVarData
-
addInnerClass
-
addBootstrapMethod
-
addNestHost
-
addNestMembers
-
addPermittedSubclasses
-
addPreloads
-
endClass
public void endClass() -
endPackageInfo
public void endPackageInfo() -
endModule
-
itemizeAttributes
Scans all attributes that 1. only have cpIndex != 0 and undefined values, types if they are found the method sets their values and types. It applies to DataVectorAttr2. only have values and undefined cpIndex if they are found the method finds the identical values in CP and assigns their cpIndexes instead of undefined indexes. It works for DataVectorAttrinvalid input: '<'?> - Parameters:
attributeList- list of attribute's list
-
printInnerClasses
private void printInnerClasses() -
write
- Throws:
IOException
-
getAttrVector
- Specified by:
getAttrVectorin classMemberData<JasmEnvironment>
-
populateAttributesList
-
write
Writes to the directory passed with -d option- Throws:
IOException
-
setByteLimit
public void setByteLimit(int bytelimit) -
nestHostAttributeExists
public boolean nestHostAttributeExists() -
nestMembersAttributesExist
public boolean nestMembersAttributesExist() -
recordAttributeExists
public boolean recordAttributeExists() -
preloadAttributeExists
public boolean preloadAttributeExists()
-