Looser coupling for ArtificialRescueChecker.

Review by: bobv

git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6698 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java b/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java
index c1ffc49..6dee693 100644
--- a/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java
+++ b/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java
@@ -291,8 +291,9 @@
    * Check the {@link ArtificialRescue} annotations in a CompilationUnit. Errors
    * are reported through {@link GWTProblem}.
    */
-  public static void check(CompilationUnit cud) {
-    new ArtificialRescueChecker(cud).check();
+  public static void check(CompilationUnitDeclaration cud,
+      boolean allowArtificialRescue) {
+    new ArtificialRescueChecker(cud, allowArtificialRescue).check();
   }
 
   /**
@@ -354,16 +355,17 @@
 
   private List<String> referencedTypes;
 
-  private ArtificialRescueChecker(CompilationUnit unit) {
-    allowArtificialRescue = unit.isGenerated();
-    cud = unit.getJdtCud();
-  }
-
   private ArtificialRescueChecker(CompilationUnitDeclaration cud) {
     allowArtificialRescue = true;
     this.cud = cud;
   }
 
+  private ArtificialRescueChecker(CompilationUnitDeclaration cud,
+      boolean allowArtificialRescue) {
+    this.cud = cud;
+    this.allowArtificialRescue = allowArtificialRescue;
+  }
+
   private void check() {
     collectTypes = false;
     reportErrors = true;
diff --git a/dev/core/src/com/google/gwt/dev/javac/CompilationUnitInvalidator.java b/dev/core/src/com/google/gwt/dev/javac/CompilationUnitInvalidator.java
index c3f586e..7c51c3d 100644
--- a/dev/core/src/com/google/gwt/dev/javac/CompilationUnitInvalidator.java
+++ b/dev/core/src/com/google/gwt/dev/javac/CompilationUnitInvalidator.java
@@ -202,7 +202,7 @@
         CompilationUnitDeclaration jdtCud = unit.getJdtCud();
         JSORestrictionsChecker.check(state.jsoState, jdtCud);
         JsniChecker.check(jdtCud);
-        ArtificialRescueChecker.check(unit);
+        ArtificialRescueChecker.check(jdtCud, unit.isGenerated());
         BinaryTypeReferenceRestrictionsChecker.check(jdtCud);
       }
     }