Revision: 8591
Author: [email protected]
Date: Fri Aug 20 08:42:07 2010
Log: tr...@r8376 was merged into this branch
  SafeASTVisitor unilaterally avoids visiting error/unreachable local types
svn merge -c8376 --ignore-ancestry https://google-web-toolkit.googlecode.com/svn/trunk

http://code.google.com/p/google-web-toolkit/source/detail?r=8591

Added:
 /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/SafeASTVisitor.java
Modified:
 /releases/2.0/branch-info.txt
/releases/2.0/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
 /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java
 /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java
 /releases/2.0/dev/core/src/com/google/gwt/dev/javac/MethodVisitor.java
/releases/2.0/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java
 /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java
 /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java
 /releases/2.0/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java

=======================================
--- /dev/null
+++ /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/SafeASTVisitor.java Fri Aug 20 08:42:07 2010
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2010 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.dev.jdt;
+
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+
+/**
+ * Avoids visiting invalid local types due to compile errors or unreachability.
+ */
+public class SafeASTVisitor extends ASTVisitor {
+
+  @Override
+  public final void endVisit(TypeDeclaration typeDecl, BlockScope scope) {
+ if (typeDecl.binding == null || typeDecl.binding.constantPoolName() == null) {
+      /*
+       * Weird case: if JDT determines that this local class is totally
+       * uninstantiable, it won't bother allocating a local name.
+       */
+      return;
+    }
+    endVisitValid(typeDecl, scope);
+  }
+
+  public void endVisitValid(TypeDeclaration typeDecl, BlockScope scope) {
+    super.endVisit(typeDecl, scope);
+  }
+
+  @Override
+  public final boolean visit(TypeDeclaration typeDecl, BlockScope scope) {
+ if (typeDecl.binding == null || typeDecl.binding.constantPoolName() == null) {
+      /*
+       * Weird case: if JDT determines that this local class is totally
+       * uninstantiable, it won't bother allocating a local name.
+       */
+      return false;
+    }
+    return visitValid(typeDecl, scope);
+  }
+
+  public boolean visitValid(TypeDeclaration typeDecl, BlockScope scope) {
+    return super.visit(typeDecl, scope);
+  }
+}
=======================================
--- /releases/2.0/branch-info.txt       Wed Jun 30 10:07:06 2010
+++ /releases/2.0/branch-info.txt       Fri Aug 20 08:42:07 2010
@@ -1528,3 +1528,6 @@
Revert the IE7 layout implementation back to the IE6 implementation to work around some quirks. svn merge -c8339 --ignore-ancestry https://google-web-toolkit.googlecode.com/svn/trunk

+tr...@r8376 was merged into this branch
+  SafeASTVisitor unilaterally avoids visiting error/unreachable local types
+ svn merge -c8376 --ignore-ancestry https://google-web-toolkit.googlecode.com/svn/trunk
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java Wed Nov 11 11:04:31 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/javac/ArtificialRescueChecker.java Fri Aug 20 08:42:07 2010
@@ -16,13 +16,13 @@
 package com.google.gwt.dev.javac;

 import com.google.gwt.core.client.impl.ArtificialRescue;
+import com.google.gwt.dev.jdt.SafeASTVisitor;
 import com.google.gwt.dev.jjs.InternalCompilerException;
 import com.google.gwt.dev.util.Empty;
 import com.google.gwt.dev.util.JsniRef;
 import com.google.gwt.dev.util.collect.Lists;

 import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.ast.Annotation;
 import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -54,16 +54,11 @@
  * </ul>
  */
 public class ArtificialRescueChecker {
-  private class Visitor extends ASTVisitor {
+  private class Visitor extends SafeASTVisitor {

     {
       assert collectTypes || reportErrors : "No work to be done";
     }
-
-    @Override
- public void endVisit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
-      processType(localTypeDeclaration);
-    }

     @Override
public void endVisit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
@@ -75,6 +70,11 @@
         CompilationUnitScope scope) {
       processType(typeDeclaration);
     }
+
+    @Override
+ public void endVisitValid(TypeDeclaration localTypeDeclaration, BlockScope scope) {
+      processType(localTypeDeclaration);
+    }

     private void processArtificialRescue(Annotation rescue) {
       if (!allowArtificialRescue) {
@@ -349,12 +349,12 @@

   private boolean collectTypes;

-  private boolean reportErrors;
-
   private final CompilationUnitDeclaration cud;

   private List<String> referencedTypes;

+  private boolean reportErrors;
+
   private ArtificialRescueChecker(CompilationUnitDeclaration cud) {
     allowArtificialRescue = true;
     this.cud = cud;
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java Wed Jan 27 12:34:44 2010 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java Fri Aug 20 08:42:07 2010
@@ -15,10 +15,10 @@
  */
 package com.google.gwt.dev.javac;

+import com.google.gwt.dev.jdt.SafeASTVisitor;
 import com.google.gwt.dev.util.InstalledHelpInfo;

 import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
 import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -78,7 +78,7 @@
     }
   }

-  private class JSORestrictionsVisitor extends ASTVisitor implements
+  private class JSORestrictionsVisitor extends SafeASTVisitor implements
       ClassFileConstants {

     private final Stack<Boolean> isJsoStack = new Stack<Boolean>();
@@ -150,34 +150,34 @@
     }

     @Override
-    public void endVisit(TypeDeclaration type, BlockScope scope) {
+    public void endVisit(TypeDeclaration type, ClassScope scope) {
       popIsJso();
     }

     @Override
-    public void endVisit(TypeDeclaration type, ClassScope scope) {
+ public void endVisit(TypeDeclaration type, CompilationUnitScope scope) {
       popIsJso();
     }

     @Override
- public void endVisit(TypeDeclaration type, CompilationUnitScope scope) {
+    public void endVisitValid(TypeDeclaration type, BlockScope scope) {
       popIsJso();
     }

     @Override
-    public boolean visit(TypeDeclaration type, BlockScope scope) {
+    public boolean visit(TypeDeclaration type, ClassScope scope) {
       pushIsJso(checkType(type));
       return true;
     }

     @Override
-    public boolean visit(TypeDeclaration type, ClassScope scope) {
+ public boolean visit(TypeDeclaration type, CompilationUnitScope scope) {
       pushIsJso(checkType(type));
       return true;
     }

     @Override
- public boolean visit(TypeDeclaration type, CompilationUnitScope scope) {
+    public boolean visitValid(TypeDeclaration type, BlockScope scope) {
       pushIsJso(checkType(type));
       return true;
     }
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java Wed Jan 27 07:18:10 2010 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JdtCompiler.java Fri Aug 20 08:42:07 2010
@@ -15,6 +15,7 @@
  */
 package com.google.gwt.dev.javac;

+import com.google.gwt.dev.jdt.SafeASTVisitor;
 import com.google.gwt.dev.jdt.TypeRefVisitor;
 import com.google.gwt.dev.util.PerfLogger;
 import com.google.gwt.dev.util.collect.IdentityHashMap;
@@ -23,7 +24,6 @@
 import com.google.gwt.util.tools.Utility;

 import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.CompilationResult;
 import org.eclipse.jdt.internal.compiler.Compiler;
 import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies;
@@ -167,27 +167,12 @@
     }
   }

-  private class FindTypesInCud extends ASTVisitor {
+  private class FindTypesInCud extends SafeASTVisitor {
Map<SourceTypeBinding, CompiledClass> map = new IdentityHashMap<SourceTypeBinding, CompiledClass>();

     public List<CompiledClass> getClasses() {
       return new ArrayList<CompiledClass>(map.values());
     }
-
-    @Override
-    public boolean visit(TypeDeclaration typeDecl, BlockScope scope) {
- CompiledClass enclosingClass = map.get(typeDecl.binding.enclosingType());
-      assert (enclosingClass != null);
-      /*
-       * Weird case: if JDT determines that this local class is totally
-       * uninstantiable, it won't bother allocating a local name.
-       */
-      if (typeDecl.binding.constantPoolName() != null) {
- CompiledClass newClass = new CompiledClass(typeDecl, enclosingClass);
-        map.put(typeDecl.binding, newClass);
-      }
-      return true;
-    }

     @Override
     public boolean visit(TypeDeclaration typeDecl, ClassScope scope) {
@@ -205,6 +190,15 @@
       map.put(typeDecl.binding, newClass);
       return true;
     }
+
+    @Override
+    public boolean visitValid(TypeDeclaration typeDecl, BlockScope scope) {
+ CompiledClass enclosingClass = map.get(typeDecl.binding.enclosingType());
+      assert (enclosingClass != null);
+      CompiledClass newClass = new CompiledClass(typeDecl, enclosingClass);
+      map.put(typeDecl.binding, newClass);
+      return true;
+    }
   }

   /**
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java Thu Nov 19 14:34:20 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/javac/JsniChecker.java Fri Aug 20 08:42:07 2010
@@ -16,6 +16,7 @@
 package com.google.gwt.dev.javac;

 import com.google.gwt.core.client.UnsafeNativeLong;
+import com.google.gwt.dev.jdt.SafeASTVisitor;
 import com.google.gwt.dev.jjs.InternalCompilerException;
 import com.google.gwt.dev.jjs.SourceInfo;
 import com.google.gwt.dev.js.ast.JsContext;
@@ -28,7 +29,6 @@
 import com.google.gwt.dev.util.collect.Sets;

 import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
 import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.Annotation;
@@ -80,7 +80,7 @@
     ReferenceBinding resolveType(String typeName);
   }

-  private class JsniDeclChecker extends ASTVisitor implements
+  private class JsniDeclChecker extends SafeASTVisitor implements
       ClassFileConstants {
     @Override
     public void endVisit(MethodDeclaration meth, ClassScope scope) {
@@ -96,10 +96,6 @@
       }
       suppressWarningsStack.pop();
     }
-
- public void endVisit(TypeDeclaration typeDeclaration, BlockScope scope) {
-      suppressWarningsStack.pop();
-    }

public void endVisit(TypeDeclaration typeDeclaration, ClassScope scope) {
       suppressWarningsStack.pop();
@@ -109,17 +105,16 @@
         CompilationUnitScope scope) {
       suppressWarningsStack.pop();
     }
+
+ public void endVisitValid(TypeDeclaration typeDeclaration, BlockScope scope) {
+      suppressWarningsStack.pop();
+    }

     @Override
     public boolean visit(MethodDeclaration meth, ClassScope scope) {
       suppressWarningsStack.push(getSuppressedWarnings(meth.annotations));
       return true;
     }
-
- public boolean visit(TypeDeclaration typeDeclaration, BlockScope scope) { - suppressWarningsStack.push(getSuppressedWarnings(typeDeclaration.annotations));
-      return true;
-    }

     @Override
public boolean visit(TypeDeclaration typeDeclaration, ClassScope scope) {
@@ -132,6 +127,11 @@
suppressWarningsStack.push(getSuppressedWarnings(typeDeclaration.annotations));
       return true;
     }
+
+ public boolean visitValid(TypeDeclaration typeDeclaration, BlockScope scope) { + suppressWarningsStack.push(getSuppressedWarnings(typeDeclaration.annotations));
+      return true;
+    }

     private void checkDecl(MethodDeclaration meth, ClassScope scope) {
       TypeReference returnType = meth.returnType;
@@ -479,8 +479,8 @@
   }

   /**
- * Check whether the argument type is the <code>long</code> primitive type.
-   * If the argument is <code>null</code>, returns <code>false</code>.
+ * Check whether the argument type is the <code>long</code> primitive type. If
+   * the argument is <code>null</code>, returns <code>false</code>.
    */
   private boolean containsLong(TypeBinding type) {
     if (type instanceof BaseTypeBinding) {
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/javac/MethodVisitor.java Wed Jan 27 07:18:10 2010 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/javac/MethodVisitor.java Fri Aug 20 08:42:07 2010
@@ -15,9 +15,9 @@
  */
 package com.google.gwt.dev.javac;

+import com.google.gwt.dev.jdt.SafeASTVisitor;
 import com.google.gwt.dev.util.Name.InternalName;

-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.Argument;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -27,8 +27,8 @@
 import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;

 /**
- * Base class of things that walk methods in a CUD and collect things
- * about interesting methods.
+ * Base class of things that walk methods in a CUD and collect things about
+ * interesting methods.
  */
 public abstract class MethodVisitor {

@@ -55,19 +55,19 @@
    * @param cud
    */
   public final void collect(final CompilationUnitDeclaration cud) {
-    cud.traverse(new ASTVisitor() {
+    cud.traverse(new SafeASTVisitor() {
       @Override
-      public void endVisit(TypeDeclaration type, BlockScope scope) {
+      public void endVisit(TypeDeclaration type, ClassScope scope) {
         collectMethods(cud, type);
       }

       @Override
-      public void endVisit(TypeDeclaration type, ClassScope scope) {
+ public void endVisit(TypeDeclaration type, CompilationUnitScope scope) {
         collectMethods(cud, type);
       }

       @Override
- public void endVisit(TypeDeclaration type, CompilationUnitScope scope) {
+      public void endVisitValid(TypeDeclaration type, BlockScope scope) {
         collectMethods(cud, type);
       }
     }, cud.scope);
@@ -81,11 +81,10 @@
    * @param method
    * @return true if processMethod should be called on this method
    */
-  protected abstract boolean interestingMethod(
-      AbstractMethodDeclaration method);
+ protected abstract boolean interestingMethod(AbstractMethodDeclaration method);

   /**
- * Provided by a subclass to process a method definition. Methods which have + * Provided by a subclass to process a method definition. Methods which have * no name are not passed to this method, even if {...@link #interestingMethod}
    * returns true.
    *
@@ -100,7 +99,7 @@
   /**
    * Collect data about interesting methods on a particular type in a
    * compilation unit.
-   *
+   *
    * @param cud
    * @param typeDecl
    */
@@ -122,13 +121,7 @@
       }

       if (!lazyInitialized) {
-        char[] constantPoolName = typeDecl.binding.constantPoolName();
-        if (constantPoolName == null) {
-          // Unreachable local type
-          return;
-        }
-        enclosingType = InternalName.toBinaryName(String.valueOf(
-            constantPoolName));
+ enclosingType = InternalName.toBinaryName(String.valueOf(typeDecl.binding.constantPoolName()));
         loc = String.valueOf(cud.getFileName());
         lazyInitialized = true;
       }
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java Wed Nov 11 11:04:31 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/FindDeferredBindingSitesVisitor.java Fri Aug 20 08:42:07 2010
@@ -18,7 +18,6 @@
 import com.google.gwt.dev.javac.GWTProblem;

 import org.eclipse.jdt.core.compiler.CharOperation;
-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.Expression;
@@ -38,7 +37,7 @@
* find <code>GWT.create()</code> class so that we can eagerly complain about
  * deferred binding problems.
  */
-public class FindDeferredBindingSitesVisitor extends ASTVisitor {
+public class FindDeferredBindingSitesVisitor extends SafeASTVisitor {

   /**
* Information about the site at which a rebind request was found, used to
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java Wed Nov 11 17:18:27 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/FindJsniRefVisitor.java Fri Aug 20 08:42:07 2010
@@ -27,7 +27,6 @@
 import com.google.gwt.dev.js.ast.JsStatement;
 import com.google.gwt.dev.js.ast.JsVisitor;

-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.ast.Argument;
 import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
 import org.eclipse.jdt.internal.compiler.lookup.ClassScope;
@@ -45,7 +44,7 @@
  * references. If {...@link #beSloppy()} is called, then it will run much more
  * quickly but it will return a superset of the actual JSNI references.
  */
-public class FindJsniRefVisitor extends ASTVisitor {
+public class FindJsniRefVisitor extends SafeASTVisitor {
   private final Set<String> jsniRefs = new LinkedHashSet<String>();

   public Set<String> getJsniRefs() {
=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java Fri Aug 14 14:43:27 2009 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/jdt/TypeRefVisitor.java Fri Aug 20 08:42:07 2010
@@ -15,7 +15,7 @@
  */
 package com.google.gwt.dev.jdt;

-import org.eclipse.jdt.internal.compiler.ASTVisitor;
+
 import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference;
 import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -41,7 +41,7 @@
 /**
* Walks the AST to determine every location from which a type is referenced.
  */
-public abstract class TypeRefVisitor extends ASTVisitor {
+public abstract class TypeRefVisitor extends SafeASTVisitor {

   private final CompilationUnitDeclaration cud;

=======================================
--- /releases/2.0/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java Tue Jan 26 15:16:53 2010 +++ /releases/2.0/dev/core/src/com/google/gwt/dev/jjs/impl/BuildTypeMap.java Fri Aug 20 08:42:07 2010
@@ -16,6 +16,7 @@
 package com.google.gwt.dev.jjs.impl;

 import com.google.gwt.dev.javac.JsniCollector;
+import com.google.gwt.dev.jdt.SafeASTVisitor;
 import com.google.gwt.dev.jjs.HasSourceInfo;
 import com.google.gwt.dev.jjs.InternalCompilerException;
 import com.google.gwt.dev.jjs.SourceInfo;
@@ -44,7 +45,6 @@
 import com.google.gwt.dev.js.ast.JsNameRef;
 import com.google.gwt.dev.js.ast.JsProgram;

-import org.eclipse.jdt.internal.compiler.ASTVisitor;
 import org.eclipse.jdt.internal.compiler.CompilationResult;
 import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
 import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
@@ -106,7 +106,7 @@
    * Note that methods and fields are not added to their classes here, that
    * isn't done until {...@link GenerateJavaDom}.
    */
-  private static class BuildDeclMapVisitor extends ASTVisitor {
+  private static class BuildDeclMapVisitor extends SafeASTVisitor {

     private String currentFileName;

@@ -292,11 +292,6 @@
         throw translateException(methodDeclaration, e);
       }
     }
-
-    @Override
- public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
-      return process(localTypeDeclaration);
-    }

     @Override
public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
@@ -308,6 +303,12 @@
         CompilationUnitScope scope) {
       return process(typeDeclaration);
     }
+
+    @Override
+    public boolean visitValid(TypeDeclaration localTypeDeclaration,
+        BlockScope scope) {
+      return process(localTypeDeclaration);
+    }

     private JField createEnumField(SourceInfo info, FieldBinding binding,
         JReferenceType enclosingType) {
@@ -545,14 +546,6 @@
       currentSeparatorPositions = compResult.lineSeparatorPositions;
       currentFileName = String.valueOf(compResult.fileName);
       SourceTypeBinding binding = typeDeclaration.binding;
-
-      if (binding.constantPoolName() == null) {
-        /*
-         * Weird case: if JDT determines that this local class is totally
-         * uninstantiable, it won't bother allocating a local name.
-         */
-        return false;
-      }
       JDeclaredType type = (JDeclaredType) typeMap.get(binding);
       try {
         // Create an override for getClass().
@@ -716,7 +709,7 @@
    * there could be forward references, it is not possible to set up super
    * types; it must be done is a subsequent pass.
    */
-  private static class BuildTypeMapVisitor extends ASTVisitor {
+  private static class BuildTypeMapVisitor extends SafeASTVisitor {

     private final JProgram program;

@@ -726,12 +719,6 @@
       this.typeMap = typeMap;
       program = this.typeMap.getProgram();
     }
-
-    @Override
- public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) { - assert (TypeDeclaration.kind(localTypeDeclaration.modifiers) != TypeDeclaration.INTERFACE_DECL);
-      return process(localTypeDeclaration);
-    }

     @Override
public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
@@ -743,6 +730,13 @@
         CompilationUnitScope scope) {
       return process(typeDeclaration);
     }
+
+    @Override
+    public boolean visitValid(TypeDeclaration localTypeDeclaration,
+        BlockScope scope) {
+ assert (TypeDeclaration.kind(localTypeDeclaration.modifiers) != TypeDeclaration.INTERFACE_DECL);
+      return process(localTypeDeclaration);
+    }

     private SourceInfo makeSourceInfo(TypeDeclaration typeDecl) {
       CompilationResult compResult = typeDecl.compilationResult;
@@ -760,14 +754,6 @@
         SourceTypeBinding binding = typeDeclaration.binding;
         if (binding instanceof LocalTypeBinding) {
           char[] localName = binding.constantPoolName();
-          if (localName == null) {
-            /*
- * Weird case: if JDT determines that this local class is totally
-             * uninstantiable, it won't bother allocating a local name.
-             */
-            return false;
-          }
-
           for (int i = 0, c = localName.length; i < c; ++i) {
             if (localName[i] == '/') {
               localName[i] = '.';

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

Reply via email to