コード例 #1
0
  /**
   * Extracts a list of exceptions of field or method names for which not to print notes, from the
   * keep configuration.
   */
  private StringMatcher createClassMemberNoteExceptionMatcher(
      List noteExceptions, boolean isField) {
    if (noteExceptions != null) {
      List noteExceptionNames = new ArrayList();
      for (int index = 0; index < noteExceptions.size(); index++) {
        KeepClassSpecification keepClassSpecification =
            (KeepClassSpecification) noteExceptions.get(index);
        List memberSpecifications =
            isField
                ? keepClassSpecification.fieldSpecifications
                : keepClassSpecification.methodSpecifications;

        if (memberSpecifications != null) {
          for (int index2 = 0; index2 < memberSpecifications.size(); index2++) {
            MemberSpecification memberSpecification =
                (MemberSpecification) memberSpecifications.get(index2);

            String memberName = memberSpecification.name;
            if (memberName != null) {
              noteExceptionNames.add(memberName);
            }
          }
        }
      }

      if (noteExceptionNames.size() > 0) {
        return new ListParser(new ClassNameParser()).parse(noteExceptionNames);
      }
    }

    return null;
  }
コード例 #2
0
  /**
   * Extracts a list of exceptions of classes for which not to print notes, from the keep
   * configuration.
   */
  private StringMatcher createClassNoteExceptionMatcher(List noteExceptions) {
    if (noteExceptions != null) {
      List noteExceptionNames = new ArrayList(noteExceptions.size());
      for (int index = 0; index < noteExceptions.size(); index++) {
        KeepClassSpecification keepClassSpecification =
            (KeepClassSpecification) noteExceptions.get(index);
        if (keepClassSpecification.markClasses) {
          // If the class itself is being kept, it's ok.
          String className = keepClassSpecification.className;
          if (className != null) {
            noteExceptionNames.add(className);
          }

          // If all of its extensions are being kept, it's ok too.
          String extendsClassName = keepClassSpecification.extendsClassName;
          if (extendsClassName != null) {
            noteExceptionNames.add(extendsClassName);
          }
        }
      }

      if (noteExceptionNames.size() > 0) {
        return new ListParser(new ClassNameParser()).parse(noteExceptionNames);
      }
    }

    return null;
  }