Improve srcgen debugging

Implement DefaultRule.toString() so it prints something
useful.

Add various toString() methods on Processor implementations
to make it clearer what each rule is doing.

Bug: 27775477
Change-Id: I1d32818b5be78cb1f995862acf5ffe39859036a4
diff --git a/tools/srcgen/currysrc/src/main/java/com/google/currysrc/api/process/DefaultRule.java b/tools/srcgen/currysrc/src/main/java/com/google/currysrc/api/process/DefaultRule.java
index 9a0f35a..2aa36cf 100644
--- a/tools/srcgen/currysrc/src/main/java/com/google/currysrc/api/process/DefaultRule.java
+++ b/tools/srcgen/currysrc/src/main/java/com/google/currysrc/api/process/DefaultRule.java
@@ -50,4 +50,13 @@
   public boolean mustModify() {
     return mustModify;
   }
+
+  @Override
+  public String toString() {
+    return "DefaultRule{" +
+        "matcher=" + matcher +
+        ", mustModify=" + mustModify +
+        ", processor=" + processor +
+        '}';
+  }
 }
diff --git a/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceSelectedJavadoc.java b/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceSelectedJavadoc.java
index 22c2e04..4d29256 100644
--- a/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceSelectedJavadoc.java
+++ b/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceSelectedJavadoc.java
@@ -70,6 +70,13 @@
     return null;
   }
 
+  @Override
+  public String toString() {
+    return "ReplaceSelectedJavadoc{" +
+        "replacements=" + replacements +
+        '}';
+  }
+
   /**
    * Reads a file containing replacement javadoc.
    *
diff --git a/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceTextCommentScanner.java b/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceTextCommentScanner.java
index d107d3b..7bcd2fb 100644
--- a/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceTextCommentScanner.java
+++ b/tools/srcgen/currysrc/src/main/java/com/google/currysrc/processors/ReplaceTextCommentScanner.java
@@ -42,7 +42,7 @@
 
   @Override
   public String toString() {
-    return "ReplaceCommentText{" +
+    return "ReplaceTextCommentScanner{" +
         "oldText='" + oldText + '\'' +
         ", newText='" + newText + '\'' +
         '}';
diff --git a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/CaptureDeprecatedElements.java b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/CaptureDeprecatedElements.java
index 0271cc5..ef5abed 100644
--- a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/CaptureDeprecatedElements.java
+++ b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/CaptureDeprecatedElements.java
@@ -126,7 +126,8 @@
       this.publicClassLocators = publicClassLocators;
     }
 
-    @Override public void process(Context context, CompilationUnit cu) {
+    @Override
+    public void process(Context context, CompilationUnit cu) {
       for (TypeLocator publicClassLocator : publicClassLocators) {
         AbstractTypeDeclaration matchedType = publicClassLocator.find(cu);
         if (matchedType != null) {
@@ -185,5 +186,12 @@
     public List<String> getDeprecatedElements() {
       return deprecatedElements;
     }
+
+    @Override
+    public String toString() {
+      return "CaptureDeprecatedProcessor{" +
+          "publicClassLocators=" + publicClassLocators +
+          '}';
+    }
   }
 }
diff --git a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/FixupBidiClassDoc.java b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/FixupBidiClassDoc.java
index 35a2141..61d6840 100644
--- a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/FixupBidiClassDoc.java
+++ b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/FixupBidiClassDoc.java
@@ -59,4 +59,9 @@
       throw new AssertionError(e);
     }
   }
+
+  @Override
+  public String toString() {
+    return "FixupBidiClassDoc{}";
+  }
 }
diff --git a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/ReplaceIcuTags.java b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/ReplaceIcuTags.java
index 1118afd..1986df8 100644
--- a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/ReplaceIcuTags.java
+++ b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/ReplaceIcuTags.java
@@ -72,6 +72,11 @@
     return true;
   }
 
+  @Override
+  public String toString() {
+    return "ReplaceIcuTags{}";
+  }
+
   private static TagElement createIcuEnhancementText(AST ast, IDocElement fragment) {
     return AstNodes.createTextTagElement(ast,
         "<strong>[icu enhancement]</strong> ICU's replacement for {@link" + fragment.toString()
diff --git a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/TranslateJcite.java b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/TranslateJcite.java
index 83fe37f..a80a47b 100644
--- a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/TranslateJcite.java
+++ b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/TranslateJcite.java
@@ -95,6 +95,11 @@
         return "// END_INCLUDE(" + jciteTag + ")";
       }
     }
+
+    @Override
+    public String toString() {
+      return "BeginEndTagsHandler{}";
+    }
   }
 
   /**
@@ -187,5 +192,13 @@
       replacement.fragments().addAll(ASTNode.copySubtrees(ast, tagNode.fragments()));
       return replacement;
     }
+
+    @Override
+    public String toString() {
+      return "InclusionHandler{" +
+          "whitelist=" + whitelist +
+          ", sampleSrcDir='" + sampleSrcDir + '\'' +
+          '}';
+    }
   }
 }
diff --git a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/CheckForBrokenJciteTag.java b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/CheckForBrokenJciteTag.java
index 2979fa1..c2f5e84 100644
--- a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/CheckForBrokenJciteTag.java
+++ b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/CheckForBrokenJciteTag.java
@@ -61,4 +61,11 @@
     }
     return null;
   }
+
+  @Override
+  public String toString() {
+    return "CheckForBrokenJciteTag{" +
+        "publicMembers=" + publicMembers +
+        '}';
+  }
 }
diff --git a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/RecordPublicApiRules.java b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/RecordPublicApiRules.java
index 9a2ac9b..498a0cd 100644
--- a/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/RecordPublicApiRules.java
+++ b/tools/srcgen/src/main/java/com/android/icu4j/srcgen/checker/RecordPublicApiRules.java
@@ -114,6 +114,11 @@
       });
     }
 
+    @Override
+    public String toString() {
+      return "RecordPublicApi{}";
+    }
+
     private boolean handleTypeDeclarationNode(AbstractTypeDeclaration node) {
       handleDeclarationNode(node);
       // Continue processing for nested types / methods.