Add error message when non-static inner class throws NoSuchMethodException

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


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8803 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/shell/ModuleSpace.java b/dev/core/src/com/google/gwt/dev/shell/ModuleSpace.java
index 792dc5d..4987dc2 100644
--- a/dev/core/src/com/google/gwt/dev/shell/ModuleSpace.java
+++ b/dev/core/src/com/google/gwt/dev/shell/ModuleSpace.java
@@ -445,6 +445,7 @@
     Throwable caught = null;
     String msg = null;
     String resultName = null;
+    Class<?> resolvedClass = null;
 
     Event moduleSpaceRebindAndCreate =
         SpeedTracerLogger.start(DevModeEventType.MODULE_SPACE_REBIND_AND_CREATE);
@@ -455,7 +456,7 @@
       resultName = rebind(sourceName);
       moduleSpaceRebindAndCreate.addData(
           "Requested Class", requestedClassName, "Result Name", resultName);
-      Class<?> resolvedClass = loadClassFromSourceName(resultName);
+      resolvedClass = loadClassFromSourceName(resultName);
       if (Modifier.isAbstract(resolvedClass.getModifiers())) {
         msg = "Deferred binding result type '" + resultName
             + "' should not be abstract";
@@ -473,9 +474,18 @@
       caught = e;
     } catch (ExceptionInInitializerError e) {
       caught = e.getException();
-    } catch (NoSuchMethodException e) {
-      msg = "Rebind result '" + resultName
-          + "' has no default (zero argument) constructors.";
+    } catch (NoSuchMethodException e) { 
+      // If it is a nested class and not declared as static, 
+      // then it's not accessible from outside.
+      //
+      if (resolvedClass.getEnclosingClass() != null 
+          && !Modifier.isStatic(resolvedClass.getModifiers())) {
+        msg = "Rebind result '" + resultName
+        + " is a non-static inner class";
+      } else {
+        msg = "Rebind result '" + resultName
+        + "' has no default (zero argument) constructors.";
+      }
       caught = e;
     } catch (InvocationTargetException e) {
       caught = e.getTargetException();