Cherry picking r10020 into releases/gwt/2.3


git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/2.3@10030 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/cfg/ConditionWhenTypeAssignableTo.java b/dev/core/src/com/google/gwt/dev/cfg/ConditionWhenTypeAssignableTo.java
index 116f806..6cf806b 100644
--- a/dev/core/src/com/google/gwt/dev/cfg/ConditionWhenTypeAssignableTo.java
+++ b/dev/core/src/com/google/gwt/dev/cfg/ConditionWhenTypeAssignableTo.java
@@ -27,6 +27,8 @@
  */
 public class ConditionWhenTypeAssignableTo extends Condition {
 
+  private static boolean warnedMissingValidationJar = false;
+
   private final String assignableToTypeName;
 
   public ConditionWhenTypeAssignableTo(String assignableToTypeName) {
@@ -59,7 +61,12 @@
       // This isn't a strict failure case because stale rules can reference
       // types that have been deleted.
       //
-      logger.log(TreeLogger.WARN, "Unknown type '" + assignableToTypeName
+      TreeLogger.Type level = TreeLogger.WARN;
+      if (shouldSuppressWarning(logger, assignableToTypeName)) {
+        // Suppress validation related errors
+        level = TreeLogger.DEBUG;
+      }
+      logger.log(level, "Unknown type '" + assignableToTypeName
           + "' specified in deferred binding rule", null);
       return false;
     }
@@ -85,4 +92,27 @@
     return toString();
   }
 
+  /**
+   * Suppress multiple validation related messages and replace with a hint.  
+   *     
+   * @param typeName fully qualified type name to check for filtering
+   */
+  // TODO(zundel): Can be removed when javax.validation is included in the JRE
+  private boolean shouldSuppressWarning(TreeLogger logger, String typeName) {
+    if (typeName.startsWith("javax.validation.")
+        || typeName.startsWith("com.google.gwt.validation.")
+        || typeName.startsWith("com.google.gwt.editor.client")) {
+      if (!warnedMissingValidationJar) {
+        warnedMissingValidationJar = true;
+        logger.log(TreeLogger.WARN, "Detected warnings related to '" + typeName + "'. "
+            + "  Is validation-api-<version>-sources.jar on the classpath?");
+        logger.log(TreeLogger.INFO, "Specify -logLevel DEBUG to see all errors.");
+        // Show the first error that matches
+        return false;
+      }
+      // Suppress subsequent errors that match
+      return true;
+    }
+    return false;
+  }
 }