Rolling back r9354 due to some GWTTestCase breakages

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


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9359 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java b/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
index 744a727..06a83fd 100644
--- a/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
+++ b/dev/core/src/com/google/gwt/dev/shell/CompilingClassLoader.java
@@ -1018,7 +1018,10 @@
 
     // Get the bytes, compiling if necessary.
     byte[] classBytes = findClassBytes(className);
-  
+    if (classBytes == null) {
+      throw new ClassNotFoundException(className);
+    }
+
     if (HasAnnotation.hasAnnotation(classBytes, GwtScriptOnly.class)) {
       scriptOnlyClasses.add(className);
       maybeInitializeScriptOnlyClassLoader();
@@ -1110,7 +1113,7 @@
   }
 
   @SuppressWarnings("deprecation")
-  private byte[] findClassBytes(String className) throws ClassNotFoundException {
+  private byte[] findClassBytes(String className) {
     if (JavaScriptHost.class.getName().equals(className)) {
       // No need to rewrite.
       return javaScriptHostBytes;
@@ -1133,12 +1136,6 @@
 
     CompilationUnit unit = (compiledClass == null)
         ? getUnitForClassName(lookupClassName) : compiledClass.getUnit();
-        
-    if (unit != null && unit.isError()) {
-      throw new ClassNotFoundException("Cannot load class " + className
-          + " because it has errors.");
-    }
-    
     if (emmaAvailable) {
       /*
        * build the map for anonymous classes. Do so only if unit has anonymous
@@ -1151,10 +1148,11 @@
           && unit.hasAnonymousClasses() && jsniMethods != null
           && jsniMethods.size() > 0 && !unit.createdClassMapping()) {
         if (!unit.constructAnonymousClassMappings(logger)) {
-          throw new ClassNotFoundException(
+          logger.log(TreeLogger.ERROR,
               "Our heuristic for mapping anonymous classes between compilers "
                   + "failed. Unsafe to continue because the wrong jsni code "
                   + "could end up running. className = " + className);
+          return null;
         }
       }
     }
@@ -1201,10 +1199,6 @@
       }
       classBytes = newBytes;
     }
-    
-    if (classBytes == null) {
-      throw new ClassNotFoundException(className);
-    }
     return classBytes;
   }