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 class
This is a wrapper for DataOutputStream, used for debugging purposes.static class
Container 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) MethodData
private static final String
private final JasmEnvironment
(package private) String
(package private) DataVectorAttr<InnerClassData>
(package private) ArrayList<MethodData>
(package private) ModuleAttr
(package private) String
(package private) CPXAttr
(package private) NestMembersAttr
private PermittedSubclassesAttr
private PreloadAttr
private RecordData
(package private) SourceDebugExtensionAttr
(package private) AttrData
Fields 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 TypeMethodDescriptionvoid
addBootstrapMethod
(BootstrapMethodData bsmData) addField
(int access, ConstantPool.ConstValue_FieldRef fieldRef) addFieldIfAbsent
(int access, ConstCell name, ConstCell descriptor) void
addInnerClass
(int access, ConstCell name, ConstCell innerClass, ConstCell outerClass) (package private) void
addLocVarData
(int opc, Indexer arg) void
addNestHost
(ConstCell hostClass) void
addNestMembers
(List<ConstCell> classes) void
addPermittedSubclasses
(List<ConstCell> classes) void
addPreloads
(List<ConstCell> classes) void
endClass()
void
void
endModule
(ModuleAttr moduleAttr) void
protected DataVector
private FieldData
getField
(ConstantPool.ConstValue_FieldRef nameAndType) private <T extends Collection<BootstrapMethodData>>
intgetFirstIndex
(T collection, BootstrapMethodData bsmData) Finds first BSM data element by value in a collectionfinal void
Initializes the ClassData.final void
final void
initAsPackageInfo
(int access, String className) final boolean
Predicate that describes if this class has an abstract flag indicating that it is the abstract class.final boolean
Predicate that describes if this class has an access flag indicating that it is an interface.final boolean
Predicate 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) boolean
boolean
private <T extends DataWriter>
DataVectorpopulateAttributesList
(T... attributes) boolean
private void
boolean
void
Rejects a record: removes the record attribute if there are no componentsprotected void
void
setByteLimit
(int bytelimit) setRecord
(int where) setSourceFileAttr
(ConstCell value_cpx) StartMethod
(int access, ConstCell name, ConstCell sig, ArrayList exc_table) private void
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 foundvoid
write
(ToolOutput toolOutput) Writes to the directory passed with -d optionvoid
Methods 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 DataVectorAttr<?> - Parameters:
attributeList
- list of attribute's list
-
printInnerClasses
private void printInnerClasses() -
write
- Throws:
IOException
-
getAttrVector
- Specified by:
getAttrVector
in 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()
-