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 EnclosingMethodAttrprivate final JasmEnvironment(package private) String(package private) DataVectorAttr<InnerClassData> private LoadableDescriptorsAttr(package private) ArrayList<MethodData> (package private) ModuleAttr(package private) String(package private) CPXAttr(package private) NestMembersAttrprivate PermittedSubclassesAttrprivate RecordData(package private) SourceDebugExtensionAttr(package private) AttrDataFields inherited from class MemberData
access, annotAttrInv, annotAttrVis, attributeLocation, deprecatedAttr, pool, signatureAttr, syntheticAttr, type_annotAttrInv, type_annotAttrVis -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBootstrapMethod(BootstrapMethodData bsmData) voidaddEnclosingMethod(ConstCell classCell, ConstCell methodRefCell) addField(int access, ConstantPool.ConstValue_FieldRef fieldRef) addFieldIfAbsent(int access, ConstCell name, ConstCell descriptor) voidaddInnerClass(int access, ConstCell name, ConstCell innerClass, ConstCell outerClass) voidaddLoadableDescriptors(List<ConstCell> utf8List) (package private) voidaddLocVarData(int opc, Indexer arg) voidaddNestHost(ConstCell hostClass) voidaddNestMembers(List<ConstCell> classes) voidaddPermittedSubclasses(List<ConstCell> classes) protected booleancheckExistence(EAttribute attribute) Checks for the existence of an attribute belonging to the MemberData.protected ClassDatacheckExistence(EAttribute attribute, long position) 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 booleanisValue()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) private <T extends DataWriter>
DataVectorpopulateAttributesList(T... attributes) private voidvoidRejects a record: removes the record attribute if there are no componentsprotected voidvoidsetByteLimit(int bytelimit) setRecord(long 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/-w optionsvoidMethods inherited from class MemberData
addAnnotations, andThenCheck, checkExistence, createPseudoMod, getDataVector, getEnvironment, getPool, setSignatureAttr, 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
-
loadableDescriptorsAttr
-
enclosingMethodAttr
-
-
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 class access flag indicates it is an interface.
-
isValue
public final boolean isValue() -
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 class 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
-
addLoadableDescriptors
-
addEnclosingMethod
-
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/-w options- Throws:
IOException
-
setByteLimit
public void setByteLimit(int bytelimit) -
checkExistence
Description copied from class:MemberDataChecks for the existence of an attribute belonging to the MemberData.- Overrides:
checkExistencein classMemberData<JasmEnvironment>- Parameters:
attribute- the attribute to check for existence- Returns:
- true if the attribute exists
-
checkExistence
-