Reviewers: bobv,

Message:
Bob, can you review this please?

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

Please review this at http://gwt-code-reviews.appspot.com/126815

Affected files:
   M dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java


Index: dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
diff --git  
a/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java  
b/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
index  
1e9cb0fd14c203f20bf331ecdbe394c2768ea04c..20cb17850c7c4027ae934b37d5e26bde9a54c225
  
100644
--- a/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
@@ -85,8 +85,19 @@ public class JSORestrictionsChecker {

      @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