Adds accessibility to certain GWT AST nodes.


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@9633 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java
index 8e3305a..5184def 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JClassLiteral.java
@@ -169,10 +169,7 @@
   private final JField field;
   private final JType refType;
 
-  /**
-   * This constructor is only used by {@link JProgram}.
-   */
-  JClassLiteral(SourceInfo sourceInfo, JType type, JField field) {
+  public JClassLiteral(SourceInfo sourceInfo, JType type, JField field) {
     super(sourceInfo);
     refType = type;
     this.field = field;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JConstructor.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JConstructor.java
index 1ad7379..20bbbf8 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JConstructor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JConstructor.java
@@ -30,15 +30,9 @@
    */
   private boolean isEmpty = false;
 
-  private JNonNullType newType;
-
-  /**
-   * These are only supposed to be constructed by JProgram.
-   */
-  JConstructor(SourceInfo info, JClassType enclosingType, JNonNullType newType) {
+  public JConstructor(SourceInfo info, JClassType enclosingType) {
     super(info, enclosingType.getShortName(), enclosingType,
         JPrimitiveType.VOID, false, false, true, false);
-    this.newType = newType;
   }
 
   @Override
@@ -57,7 +51,7 @@
   }
 
   public JNonNullType getNewType() {
-    return newType;
+    return getEnclosingType().getNonNull();
   }
 
   /**
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JField.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JField.java
index 279a12a..b0ff2fb 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JField.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JField.java
@@ -50,7 +50,7 @@
   private boolean isThisRef;
   private boolean isVolatile;
 
-  JField(SourceInfo info, String name, JDeclaredType enclosingType, JType type,
+  public JField(SourceInfo info, String name, JDeclaredType enclosingType, JType type,
       boolean isStatic, Disposition disposition) {
     super(info, name, type, disposition.isFinal());
     this.enclosingType = enclosingType;
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JInterfaceType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JInterfaceType.java
index 46cce3e..bfec2b8 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JInterfaceType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JInterfaceType.java
@@ -22,7 +22,7 @@
  */
 public class JInterfaceType extends JDeclaredType {
 
-  JInterfaceType(SourceInfo info, String name) {
+  public JInterfaceType(SourceInfo info, String name) {
     super(info, name);
   }
 
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
index 80b1d77..233c0e9 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
@@ -357,8 +357,6 @@
 
   private final Map<String, JDeclaredType> typeNameMap = new HashMap<String, JDeclaredType>();
 
-  private JNonNullType typeNonNullString;
-
   private JClassType typeSpecialClassLiteralHolder;
 
   private JClassType typeSpecialJavaScriptObject;
@@ -428,7 +426,6 @@
         typeJavaLangObject = x;
       } else if (name.equals("java.lang.String")) {
         typeString = x;
-        typeNonNullString = x.getNonNull();
       } else if (name.equals("java.lang.Enum")) {
         typeJavaLangEnum = x;
       } else if (name.equals("java.lang.Class")) {
@@ -445,8 +442,7 @@
 
   public JConstructor createConstructor(SourceInfo info,
       JClassType enclosingType) {
-    JConstructor x = new JConstructor(info, enclosingType,
-        enclosingType.getNonNull());
+    JConstructor x = new JConstructor(info, enclosingType);
     x.setBody(new JMethodBody(info));
     if (indexedTypes.containsValue(enclosingType)) {
       indexedMethods.put(enclosingType.getShortName() + '.'
@@ -938,7 +934,7 @@
     JStringLiteral toReturn = stringLiteralMap.get(s);
     if (toReturn == null) {
       toReturn = new JStringLiteral(stringPoolSourceInfo.makeChild(
-          JProgram.class, "String literal: " + s), s, typeNonNullString);
+          JProgram.class, "String literal: " + s), s, typeString);
       stringLiteralMap.put(s, toReturn);
     }
     toReturn.getSourceInfo().merge(sourceInfo);
@@ -1153,7 +1149,7 @@
   }
 
   public boolean isJavaLangString(JType type) {
-    return type == typeString || type == typeNonNullString;
+    return type == typeString || type == typeString.getNonNull();
   }
 
   public boolean isJavaScriptObject(JType type) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java
index 894b765..ce1aae0 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JStringLiteral.java
@@ -22,13 +22,11 @@
  */
 public class JStringLiteral extends JValueLiteral {
 
-  private final JNonNullType stringType;
+  private final JClassType stringType;
   private final String value;
 
-  /**
-   * These are only supposed to be constructed by JProgram.
-   */
-  JStringLiteral(SourceInfo sourceInfo, String value, JNonNullType stringType) {
+  public JStringLiteral(SourceInfo sourceInfo, String value,
+      JClassType stringType) {
     super(sourceInfo);
     this.value = value;
     this.stringType = stringType;
@@ -40,7 +38,7 @@
   }
 
   public JNonNullType getType() {
-    return stringType;
+    return stringType.getNonNull();
   }
 
   public String getValue() {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
index cd1b578..0f18a51 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaAST.java
@@ -1654,7 +1654,7 @@
       assert (elementDecl.initializer == null);
 
       JForStatement result;
-      if (x.collection.resolvedType.isArrayType()) {
+      if (x.collectionVariable != null) {
         /**
          * <pre>
          * for (final T[] i$array = collection,
diff --git a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerOutDir.java b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerOutDir.java
index 26cd3b7..bcd8458 100644
--- a/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerOutDir.java
+++ b/dev/core/src/com/google/gwt/dev/util/arg/ArgHandlerOutDir.java
@@ -22,7 +22,7 @@
 /**
  * Argument handler for processing the output directory flag.
  */
-public final class ArgHandlerOutDir extends ArgHandlerDir {
+public class ArgHandlerOutDir extends ArgHandlerDir {
 
   private final OptionOutDir option;