Revision: 7340
Author: [email protected]
Date: Fri Dec 18 14:16:56 2009
Log: Fixes JSORestrictions crash in bad units.

In rare cases, the old code would crash with a null scope.

Review by: bobv
http://code.google.com/p/google-web-toolkit/source/detail?r=7340

Modified:
  /trunk/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java

=======================================
---  
/trunk/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java        
 
Tue Nov 10 20:42:30 2009
+++  
/trunk/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java        
 
Fri Dec 18 14:16:56 2009
@@ -85,8 +85,19 @@

      @Override
      public void endVisit(AllocationExpression exp, BlockScope scope) {
+      // In rare cases we might not be able to resolve the expression.
+      if (exp.type == null) {
+        return;
+      }
+      TypeBinding resolvedType = exp.resolvedType;
+      if (resolvedType == null) {
+        if (scope == null) {
+          return;
+        }
+        resolvedType = exp.type.resolveType(scope);
+      }
        // Anywhere an allocation occurs is wrong.
-      if (exp.type != null && isJsoSubclass(exp.type.resolveType(scope))) {
+      if (isJsoSubclass(resolvedType)) {
          errorOn(exp, ERR_NEW_JSO);
        }
      }

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to