Make ValidationTool.exec() public and refactor it so that
callers can provide their own JavaCompiler instance.

Review at http://gwt-code-reviews.appspot.com/1859803


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11354 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/web/bindery/requestfactory/apt/ValidationTool.java b/user/src/com/google/web/bindery/requestfactory/apt/ValidationTool.java
index 206b9e9..5f54312 100644
--- a/user/src/com/google/web/bindery/requestfactory/apt/ValidationTool.java
+++ b/user/src/com/google/web/bindery/requestfactory/apt/ValidationTool.java
@@ -212,7 +212,11 @@
   /**
    * A testable "main" method.
    */
-  static boolean exec(String[] args) throws IOException {
+  public static boolean exec(String[] args) throws IOException {
+    return exec(args, ToolProvider.getSystemJavaCompiler());
+  }
+
+  public static boolean exec(String[] args, JavaCompiler compiler) throws IOException {
     if (args.length < 2) {
       System.err.println("java -cp requestfactory-client.jar:your_server-code.jar "
           + ValidationTool.class.getCanonicalName()
@@ -222,7 +226,6 @@
           + "for more information.");
       return false;
     }
-    JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
     if (compiler == null) {
       System.err.println("This tool must be run with a JDK, not a JRE");
       return false;