Class ClassData


class ClassData extends MemberData<JasmEnvironment>
ClassData

This is the main data structure for representing parsed class data. This structure renders directly to a class file.

  • Field Details

  • Constructor Details

    • ClassData

      public ClassData(JasmEnvironment environment, CFVersion cfv)
      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 class
      super_class - The constant pool reference to the super class
      interfaces - A list of interfaces that this class implements
    • initAsPackageInfo

      public final void initAsPackageInfo(int access, String className)
    • 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

      public AttrData setSourceFileAttr(ConstCell value_cpx)
    • setSourceDebugExtensionAttr

      public SourceDebugExtensionAttr setSourceDebugExtensionAttr()
    • setRecord

      public RecordData setRecord(int where)
    • rejectRecord

      public void rejectRecord()
      Rejects a record: removes the record attribute if there are no components
    • makeFieldRef

      public ConstantPool.ConstValue_FieldRef makeFieldRef(ConstCell name, ConstCell descriptor)
    • addFieldIfAbsent

      public FieldData addFieldIfAbsent(int access, ConstCell name, ConstCell descriptor)
    • getField

      private FieldData getField(ConstantPool.ConstValue_FieldRef nameAndType)
    • addField

      public FieldData addField(int access, ConstantPool.ConstValue_FieldRef fieldRef)
    • addField

      public FieldData addField(int access, ConstCell name, ConstCell sig)
    • StartMethod

      public MethodData StartMethod(int access, ConstCell name, ConstCell sig, ArrayList exc_table)
    • EndMethod

      public void EndMethod()
    • LocalMethodRef

      public ConstCell LocalMethodRef(ConstValue nape)
    • LocalMethodRef

      public ConstCell LocalMethodRef(ConstCell name, ConstCell sig)
    • addLocVarData

      void addLocVarData(int opc, Indexer arg)
    • addInnerClass

      public void addInnerClass(int access, ConstCell name, ConstCell innerClass, ConstCell outerClass)
    • addBootstrapMethod

      public void addBootstrapMethod(BootstrapMethodData bsmData)
    • addNestHost

      public void addNestHost(ConstCell hostClass)
    • addNestMembers

      public void addNestMembers(List<ConstCell> classes)
    • addPermittedSubclasses

      public void addPermittedSubclasses(List<ConstCell> classes)
    • addPreloads

      public void addPreloads(List<ConstCell> classes)
    • endClass

      public void endClass()
    • endPackageInfo

      public void endPackageInfo()
    • endModule

      public void endModule(ModuleAttr moduleAttr)
    • itemizeAttributes

      private <A extends AttrData> void itemizeAttributes(A... attributeList)
      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 DataVectorAttr 2. 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

      public void write(CheckedDataOutputStream out) throws IOException
      Throws:
      IOException
    • getAttrVector

      protected DataVector getAttrVector()
      Specified by:
      getAttrVector in class MemberData<JasmEnvironment>
    • populateAttributesList

      private <T extends DataWriter> DataVector populateAttributesList(T... attributes)
    • write

      public void write(ToolOutput toolOutput) throws IOException
      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()