コード例 #1
0
ファイル: InterfaceSorter.java プロジェクト: hnkien/proguard
  public void visitProgramClass(ProgramClass programClass) {
    int[] interfaces = programClass.u2interfaces;
    int interfacesCount = programClass.u2interfacesCount;

    if (interfacesCount > 1) {
      // Sort the interfaces.
      Arrays.sort(interfaces, 0, interfacesCount);

      // Remove any duplicate entries.
      int newInterfacesCount = 0;
      int previousInterfaceIndex = 0;
      for (int index = 0; index < interfacesCount; index++) {
        int interfaceIndex = interfaces[index];

        // Isn't this a duplicate of the previous interface?
        if (interfaceIndex != previousInterfaceIndex) {
          interfaces[newInterfacesCount++] = interfaceIndex;

          // Remember the interface.
          previousInterfaceIndex = interfaceIndex;
        }
      }

      programClass.u2interfacesCount = newInterfacesCount;

      // Update the signature, if any
      programClass.attributesAccept(this);
    }
  }
コード例 #2
0
ファイル: UsageMarker.java プロジェクト: ruhem/TerminalIDE
  protected void markProgramClassBody(ProgramClass programClass) {
    // Mark this class's name.
    markConstant(programClass, programClass.u2thisClass);

    // Mark the superclass.
    if (programClass.u2superClass != 0) {
      markConstant(programClass, programClass.u2superClass);
    }

    // Give the interfaces preliminary marks.
    programClass.hierarchyAccept(false, false, true, false, interfaceUsageMarker);

    // Explicitly mark the <clinit> method.
    programClass.methodAccept(
        ClassConstants.INTERNAL_METHOD_NAME_CLINIT,
        ClassConstants.INTERNAL_METHOD_TYPE_CLINIT,
        this);

    // Explicitly mark the parameterless <init> method.
    programClass.methodAccept(
        ClassConstants.INTERNAL_METHOD_NAME_INIT, ClassConstants.INTERNAL_METHOD_TYPE_INIT, this);

    // Process all class members that have already been marked as possibly used.
    programClass.fieldsAccept(possiblyUsedMemberUsageMarker);
    programClass.methodsAccept(possiblyUsedMemberUsageMarker);

    // Mark the attributes.
    programClass.attributesAccept(this);
  }
コード例 #3
0
  public void visitProgramClass(ProgramClass programClass) {
    // Visit the constant pool entries.
    programClass.constantPoolEntriesAccept(this);

    // Visit the fields and methods.
    programClass.fieldsAccept(this);
    programClass.methodsAccept(this);

    // Visit the attributes.
    programClass.attributesAccept(this);
  }