public void visitProgramMember(ProgramClass programClass, ProgramMember programMember) {
    // Let the visitor visit the classes referenced in the descriptor string.
    programMember.referencedClassesAccept(classVisitor);

    // Visit the attributes.
    programMember.attributesAccept(programClass, this);
  }
Ejemplo n.º 2
0
 /** Deletes the specified attribute from the target. */
 public void deleteAttribute(String attributeName) {
   // What's the target?
   if (targetAttribute != null) {
     targetAttribute.u2attributesCount =
         deleteAttribute(
             targetAttribute.u2attributesCount, targetAttribute.attributes, attributeName);
   } else if (targetMember != null) {
     targetMember.u2attributesCount =
         deleteAttribute(targetMember.u2attributesCount, targetMember.attributes, attributeName);
   } else {
     targetClass.u2attributesCount =
         deleteAttribute(targetClass.u2attributesCount, targetClass.attributes, attributeName);
   }
 }
Ejemplo n.º 3
0
  /** Adds the given attribute to the target. */
  public void addAttribute(Attribute attribute) {
    // What's the target?
    if (targetAttribute != null) {
      // Try to replace an existing attribute.
      if (!replaceAttributes
          || !replaceAttribute(
              targetAttribute.u2attributesCount, targetAttribute.attributes, attribute)) {
        // Otherwise append the attribute.
        targetAttribute.attributes =
            addAttribute(targetAttribute.u2attributesCount, targetAttribute.attributes, attribute);

        targetAttribute.u2attributesCount++;
      }
    } else if (targetMember != null) {
      // Try to replace an existing attribute.
      if (!replaceAttributes
          || !replaceAttribute(
              targetMember.u2attributesCount, targetMember.attributes, attribute)) {
        // Otherwise append the attribute.
        targetMember.attributes =
            addAttribute(targetMember.u2attributesCount, targetMember.attributes, attribute);

        targetMember.u2attributesCount++;
      }
    } else {
      // Try to replace an existing attribute.
      if (!replaceAttributes
          || !replaceAttribute(targetClass.u2attributesCount, targetClass.attributes, attribute)) {
        // Otherwise append the attribute.
        targetClass.attributes =
            addAttribute(targetClass.u2attributesCount, targetClass.attributes, attribute);

        targetClass.u2attributesCount++;
      }
    }
  }
 /**
  * Returns the line number range of the given class member, followed by a colon, or just an empty
  * String if no range is available.
  */
 private static String lineNumberRange(ProgramClass programClass, ProgramMember programMember) {
   String range = programMember.getLineNumberRange(programClass);
   return range != null ? (range + ":") : "";
 }