コード例 #1
0
  public void visitAnyRefConstant(Clazz clazz, RefConstant refConstant) {
    Clazz referencedClass = refConstant.referencedClass;
    if (referencedClass != null
        && (referencedClass.getAccessFlags() & ClassConstants.INTERNAL_ACC_PUBLIC) == 0) {
      setInvokesPackageVisibleMembers(clazz);
    }

    Member referencedMember = refConstant.referencedMember;
    if (referencedMember != null
        && (referencedMember.getAccessFlags()
                & (ClassConstants.INTERNAL_ACC_PUBLIC | ClassConstants.INTERNAL_ACC_PRIVATE))
            == 0) {
      setInvokesPackageVisibleMembers(clazz);
    }
  }
コード例 #2
0
 public String toString() {
   return "certain="
       + certain
       + ", depth="
       + depth
       + ": "
       + reason
       + (clazz != null ? clazz.getName() : "(none)")
       + ": "
       + (member != null ? member.getName(clazz) : "(none)");
 }
コード例 #3
0
  public void visitAnyMember(Clazz clazz, Member member) {
    // Special cases: <clinit> and <init> are always kept unchanged.
    // We can ignore them here.
    String name = member.getName(clazz);
    if (name.equals(ClassConstants.INTERNAL_METHOD_NAME_CLINIT)
        || name.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT)) {
      return;
    }

    // Get the member's new name.
    String newName = MemberObfuscator.newMemberName(member);

    // Remember it, if it has already been set.
    if (newName != null) {
      // Get the member's descriptor.
      String descriptor = member.getDescriptor(clazz);

      // Check whether we're allowed to do aggressive overloading
      if (!allowAggressiveOverloading) {
        // Trim the return argument from the descriptor if not.
        // Works for fields and methods alike.
        descriptor = descriptor.substring(0, descriptor.indexOf(')') + 1);
      }

      // Put the [descriptor - new name] in the map,
      // creating a new [new name - old name] map if necessary.
      Map nameMap = MemberObfuscator.retrieveNameMap(descriptorMap, descriptor);

      // Isn't there another original name for this new name, or should
      // this original name get priority?
      String otherName = (String) nameMap.get(newName);
      if (otherName == null
          || MemberObfuscator.hasFixedNewMemberName(member)
          || name.compareTo(otherName) < 0) {
        // Remember not to use the new name again in this name space.
        nameMap.put(newName, name);
      }
    }
  }
コード例 #4
0
 /** Applies the given class visitor to this mark's member, if any. */
 public void acceptMemberVisitor(MemberVisitor memberVisitor) {
   if (clazz != null && member != null) {
     member.accept(clazz, memberVisitor);
   }
 }