Noop cleanup on array related classes and GwtAstBuilder.
Change-Id: I5ed8840e100bb3bd98e8922e4f849d4382825203
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 92a9553..f251fa8 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JSORestrictionsChecker.java
@@ -73,7 +73,6 @@
"Constructors must be 'protected' in subclasses of JavaScriptObject";
public static final String ERR_OVERRIDDEN_METHOD =
"Methods cannot be overridden in JavaScriptObject subclasses";
- public static final String JSO_CLASS = "com/google/gwt/core/client/JavaScriptObject";
public static final String ERR_JS_FUNCTION_ONLY_ALLOWED_ON_FUNCTIONAL_INTERFACE =
"@JsFunction is only allowed on functional interface";
public static final String ERR_JS_FUNCTION_CANNOT_HAVE_DEFAULT_METHODS =
@@ -128,7 +127,7 @@
resolvedType = exp.type.resolveType(scope);
}
// Anywhere an allocation occurs is wrong.
- if (isJsoSubclass(resolvedType)) {
+ if (JdtUtil.isJsoSubclass(resolvedType)) {
errorOn(exp, ERR_NEW_JSO);
}
}
@@ -232,7 +231,7 @@
SourceTypeBinding binding = type.binding;
checkJsFunction(type, binding);
- if (!isJsoSubclass(binding)) {
+ if (!JdtUtil.isJsoSubclass(binding)) {
return ClassState.NORMAL;
}
@@ -286,36 +285,6 @@
checker.check();
}
- /**
- * Returns {@code true} if {@code typeBinding} is {@code JavaScriptObject} or
- * any subtype.
- */
- public static boolean isJso(TypeBinding typeBinding) {
- if (!(typeBinding instanceof ReferenceBinding)) {
- return false;
- }
- ReferenceBinding binding = (ReferenceBinding) typeBinding;
- while (binding != null) {
- if (JSO_CLASS.equals(String.valueOf(binding.constantPoolName()))) {
- return true;
- }
- binding = binding.superclass();
- }
- return false;
- }
-
- /**
- * Returns {@code true} if {@code typeBinding} is a subtype of
- * {@code JavaScriptObject}, but not {@code JavaScriptObject} itself.
- */
- public static boolean isJsoSubclass(TypeBinding typeBinding) {
- if (!(typeBinding instanceof ReferenceBinding)) {
- return false;
- }
- ReferenceBinding binding = (ReferenceBinding) typeBinding;
- return isJso(binding.superclass());
- }
-
static String errAlreadyImplemented(String intfName, String impl1,
String impl2) {
return "Only one JavaScriptObject type may implement the methods of an "
diff --git a/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java b/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java
index 97b7f25..8c46eac 100644
--- a/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java
+++ b/dev/core/src/com/google/gwt/dev/javac/JdtUtil.java
@@ -51,6 +51,8 @@
* Utility functions to interact with JDT classes.
*/
public final class JdtUtil {
+ public static final String JSO_CLASS = "com/google/gwt/core/client/JavaScriptObject";
+
/**
* Returns a source name from an array of names.
*/
@@ -397,4 +399,34 @@
public static boolean isStaticClass(SourceTypeBinding binding) {
return binding.isNestedType() && binding.isStatic();
}
+
+ /**
+ * Returns {@code true} if {@code typeBinding} is {@code JavaScriptObject} or
+ * any subtype.
+ */
+ public static boolean isJso(TypeBinding typeBinding) {
+ if (!(typeBinding instanceof ReferenceBinding)) {
+ return false;
+ }
+ ReferenceBinding binding = (ReferenceBinding) typeBinding;
+ while (binding != null) {
+ if (JSO_CLASS.equals(String.valueOf(binding.constantPoolName()))) {
+ return true;
+ }
+ binding = binding.superclass();
+ }
+ return false;
+ }
+
+ /**
+ * Returns {@code true} if {@code typeBinding} is a subtype of
+ * {@code JavaScriptObject}, but not {@code JavaScriptObject} itself.
+ */
+ public static boolean isJsoSubclass(TypeBinding typeBinding) {
+ if (!(typeBinding instanceof ReferenceBinding)) {
+ return false;
+ }
+ ReferenceBinding binding = (ReferenceBinding) typeBinding;
+ return isJso(binding.superclass());
+ }
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
index f572b8d..b9cf8c9 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JArrayType.java
@@ -70,6 +70,11 @@
}
@Override
+ public boolean isArrayType() {
+ return true;
+ }
+
+ @Override
public boolean isAbstract() {
return false;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JClassType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JClassType.java
index 8470f1c..ac7fe51 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JClassType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JClassType.java
@@ -64,9 +64,9 @@
@Override
public final JMethod getInitMethod() {
assert getMethods().size() > 1;
- JMethod init = this.getMethods().get(1);
+ JMethod init = this.getMethods().get(GwtAstBuilder.INIT_METHOD_INDEX);
- if (!init.getName().equals(GwtAstBuilder.INIT_NAME)) {
+ if (!init.getName().equals(GwtAstBuilder.INIT_NAME_METHOD_NAME)) {
// the init method was removed.
return null;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclaredType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclaredType.java
index 9191b38..f293b8a 100755
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclaredType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JDeclaredType.java
@@ -168,10 +168,13 @@
*/
public final void addMethod(int index, JMethod method) {
assert method.getEnclosingType() == this;
- assert !method.getName().equals(GwtAstBuilder.CLINIT_NAME) || getMethods().size() == 0 : "Attempted adding "
- + "$clinit method with index != 0";
- assert !method.getName().equals(GwtAstBuilder.INIT_NAME) || method.getParams().size() != 0 ||
- getMethods().size() == 1 : "Attempted adding $init method with index != 1";
+ assert !method.getName().equals(GwtAstBuilder.CLINIT_METHOD_NAME)
+ || getMethods().size() == 0
+ : "Attempted adding $clinit method with index != 0";
+ assert !method.getName().equals(GwtAstBuilder.INIT_NAME_METHOD_NAME)
+ || method.getParams().size() != 0
+ || getMethods().size() == 1
+ : "Attempted adding $init method with index != 1";
methods = Lists.add(methods, index, method);
}
@@ -254,10 +257,10 @@
*/
public final JMethod getClinitMethod() {
assert getMethods().size() != 0;
- JMethod clinit = this.getMethods().get(0);
+ JMethod clinit = this.getMethods().get(GwtAstBuilder.CLINIT_METHOD_INDEX);
assert clinit != null;
- assert clinit.getName().equals(GwtAstBuilder.CLINIT_NAME);
+ assert clinit.getName().equals(GwtAstBuilder.CLINIT_METHOD_NAME);
return clinit;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java
index 6a162a3..da6e878 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JNewArray.java
@@ -38,9 +38,9 @@
new JClassLiteral(info.makeChild(), arrayType.getLeafType()));
}
- public final List<JExpression> dims;
+ private final List<JExpression> dimensionExpressions;
- public final List<JExpression> initializers;
+ private final List<JExpression> initializers;
/**
* The list of class literals that will be needed to support this expression.
@@ -49,20 +49,28 @@
private JArrayType type;
- public JNewArray(SourceInfo info, JArrayType type, List<JExpression> dims,
+ public JNewArray(SourceInfo info, JArrayType type, List<JExpression> dimensionExpressions,
List<JExpression> initializers, JClassLiteral leafTypeClassLiteral) {
super(info);
this.type = type;
- this.dims = dims;
+ this.dimensionExpressions = dimensionExpressions;
this.initializers = initializers;
this.leafTypeClassLiteral = leafTypeClassLiteral;
- assert !(leafTypeClassLiteral.getRefType() instanceof JArrayType);
+ assert !(leafTypeClassLiteral.getRefType().isArrayType());
}
public JArrayType getArrayType() {
return type;
}
+ public List<JExpression> getDimensionExpressions() {
+ return dimensionExpressions;
+ }
+
+ public List<JExpression> getInitializers() {
+ return initializers;
+ }
+
/**
* Return a class literal for the leaf type of the array.
*/
@@ -77,21 +85,14 @@
@Override
public boolean hasSideEffects() {
- if (initializers != null) {
- for (JExpression initializer : initializers) {
- if (initializer.hasSideEffects()) {
- return true;
- }
+ assert ((dimensionExpressions != null) ^ (initializers != null));
+
+ for (JExpression expression : initializers != null ? initializers : dimensionExpressions) {
+ if (expression.hasSideEffects()) {
+ return true;
}
}
- if (dims != null) {
- for (JExpression dim : dims) {
- if (dim.hasSideEffects()) {
- return true;
- }
- }
- }
- // The new operation on an array does not actually cause side effects.
+
return false;
}
@@ -102,17 +103,10 @@
@Override
public void traverse(JVisitor visitor, Context ctx) {
if (visitor.visit(this, ctx)) {
- assert ((dims != null) ^ (initializers != null));
+ assert ((dimensionExpressions != null) ^ (initializers != null));
- if (dims != null) {
- visitor.accept(dims);
- }
+ visitor.accept(initializers != null ? initializers : dimensionExpressions);
- if (initializers != null) {
- visitor.accept(initializers);
- }
-
- // Visit the base class that will eventually get generated.
leafTypeClassLiteral = (JClassLiteral) visitor.accept(leafTypeClassLiteral);
}
visitor.endVisit(this, ctx);
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 3b33bdc..a20648a 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
@@ -261,7 +261,7 @@
JDeclaredType enclosingType = method.getEnclosingType();
boolean isClinit = enclosingType != null && method == enclosingType.getClinitMethod();
- assert !isClinit || method.getName().equals(GwtAstBuilder.CLINIT_NAME);
+ assert !isClinit || method.getName().equals(GwtAstBuilder.CLINIT_METHOD_NAME);
return isClinit;
}
@@ -270,11 +270,11 @@
if (method.isStatic()) {
// Hack, check the name.
- return method.getName().equals(GwtAstBuilder.STATIC_INIT_NAME);
+ return method.getName().equals(GwtAstBuilder.STATIC_INIT_METHOD_NAME);
}
boolean isInit = enclosingType != null && method == enclosingType.getInitMethod();
- assert !isInit || method.getName().equals(GwtAstBuilder.INIT_NAME);
+ assert !isInit || method.getName().equals(GwtAstBuilder.INIT_NAME_METHOD_NAME);
return isInit;
}
@@ -484,6 +484,9 @@
return EnumSet.allOf(DispatchType.class);
}
+ if (type.isArrayType()) {
+ return EnumSet.of(DispatchType.JAVA_ARRAY);
+ }
EnumSet<DispatchType> dispatchSet = EnumSet.noneOf(DispatchType.class);
DispatchType dispatchType = getRepresentedAsNativeTypesDispatchMap().get(type);
if (dispatchType != null) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JReferenceType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JReferenceType.java
index 09c26c7..9107568 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JReferenceType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JReferenceType.java
@@ -141,6 +141,11 @@
}
@Override
+ public boolean isArrayType() {
+ return ref.isArrayType();
+ }
+
+ @Override
public boolean isJsoType() {
return ref.isJsoType();
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/JType.java b/dev/core/src/com/google/gwt/dev/jjs/ast/JType.java
index d3d8d55..aa8d20a 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/JType.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/JType.java
@@ -62,6 +62,10 @@
*/
public abstract boolean canBeNull();
+ public boolean isArrayType() {
+ return false;
+ }
+
/**
* Returns {@code true} if this is {@link JReferenceType.JNullType.INSTANCE}.
*/
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/RuntimeConstants.java b/dev/core/src/com/google/gwt/dev/jjs/ast/RuntimeConstants.java
index 6698033..af1d122 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/RuntimeConstants.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/RuntimeConstants.java
@@ -25,9 +25,9 @@
public static final String ASYNC_FRAGMENT_LOADER_RUN_ASYNC = "AsyncFragmentLoader.runAsync";
public static final String ARRAY_GET_CLASS_LITERAL_FOR_ARRAY = "Array.getClassLiteralForArray";
- public static final String ARRAY_INIT_DIM = "Array.initDim";
- public static final String ARRAY_INIT_DIMS = "Array.initDims";
- public static final String ARRAY_INIT_VALUES = "Array.initValues";
+ public static final String ARRAY_INITIALIZE_UNIDIMENSIONAL_ARRAY = "Array.initUnidimensionalArray";
+ public static final String ARRAY_INITIALIZE_MULTIDIMENSIONAL_ARRAY = "Array.initMultidimensionalArray";
+ public static final String ARRAY_STAMP_JAVA_TYPE_INFO = "Array.stampJavaTypeInfo";
public static final String ARRAY_SET_CHECK = "Array.setCheck";
public static final String CAST_CHAR_TO_STRING = "Cast.charToString";
diff --git a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsonArray.java b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsonArray.java
index 9519907..21546a2 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsonArray.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/ast/js/JsonArray.java
@@ -20,8 +20,9 @@
import com.google.gwt.dev.jjs.ast.JClassType;
import com.google.gwt.dev.jjs.ast.JExpression;
import com.google.gwt.dev.jjs.ast.JVisitor;
+import com.google.gwt.thirdparty.guava.common.collect.Lists;
-import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -29,28 +30,33 @@
*/
public class JsonArray extends JExpression {
- private final List<JExpression> exprs = new ArrayList<JExpression>();
+ private final List<JExpression> expressions;
- private JClassType jsoType;
+ private JClassType arrayType;
- public JsonArray(SourceInfo sourceInfo, JClassType jsoType) {
+ public JsonArray(SourceInfo sourceInfo, JClassType arrayType, Iterable<JExpression> expressions) {
super(sourceInfo);
- this.jsoType = jsoType;
+ this.arrayType = arrayType;
+ this.expressions = Lists.newArrayList(expressions);
}
- public List<JExpression> getExprs() {
- return exprs;
+ public JsonArray(SourceInfo sourceInfo, JClassType arrayType, JExpression... expressions) {
+ this(sourceInfo, arrayType, Arrays.asList(expressions));
+ }
+
+ public List<JExpression> getExpressions() {
+ return expressions;
}
@Override
public JClassType getType() {
- return jsoType;
+ return arrayType;
}
@Override
public boolean hasSideEffects() {
- for (int i = 0, c = getExprs().size(); i < c; ++i) {
- if (exprs.get(i).hasSideEffects()) {
+ for (JExpression expression : expressions) {
+ if (expression.hasSideEffects()) {
return true;
}
}
@@ -61,14 +67,14 @@
* Resolve an external references during AST stitching.
*/
public void resolve(JClassType jsoType) {
- assert jsoType.replaces(this.jsoType);
- this.jsoType = jsoType;
+ assert jsoType.replaces(this.arrayType);
+ this.arrayType = jsoType;
}
@Override
public void traverse(JVisitor visitor, Context ctx) {
if (visitor.visit(this, ctx)) {
- visitor.accept(exprs);
+ visitor.accept(expressions);
}
visitor.endVisit(this, ctx);
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java
index f94af6c..24c4ba8 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ArrayNormalizer.java
@@ -78,17 +78,20 @@
public void endVisit(JNewArray x, Context ctx) {
JArrayType type = x.getArrayType();
- if (x.initializers != null) {
- processInitializers(x, ctx, type);
- } else {
- int realDims = x.dims.size();
- assert (realDims >= 1);
- if (realDims == 1) {
- processDim(x, ctx, type);
- } else {
- processDims(x, ctx, type);
- }
+ if (x.getInitializers() != null) {
+ ctx.replaceMe(createArrayFromInitializers(x, type));
+ return;
}
+
+ int suppliedDimensions = x.getDimensionExpressions().size();
+ assert (suppliedDimensions >= 1);
+
+ if (suppliedDimensions == 1) {
+ ctx.replaceMe(initializeUnidimensionalArray(x, type));
+ return;
+ }
+
+ ctx.replaceMe(initializeMultidimensionalArray(x, type));
}
private JRuntimeTypeReference getElementRuntimeTypeReference(SourceInfo sourceInfo,
@@ -123,7 +126,7 @@
return castableTypeMap;
}
- private void processDim(JNewArray x, Context ctx, JArrayType arrayType) {
+ private JExpression initializeUnidimensionalArray(JNewArray x, JArrayType arrayType) {
// override the type of the called method with the array's type
SourceInfo sourceInfo = x.getSourceInfo();
JLiteral classLit = x.getLeafTypeClassLiteral();
@@ -132,16 +135,16 @@
getElementRuntimeTypeReference(sourceInfo, arrayType);
JType elementType = arrayType.getElementType();
JIntLiteral elementTypeCategory = getTypeCategoryLiteral(elementType);
- JExpression dim = x.dims.get(0);
-
- JMethodCall call = new JMethodCall(sourceInfo, null, initDim);
+ JExpression dim = x.getDimensionExpressions().get(0);
+ JMethodCall call =
+ new JMethodCall(sourceInfo, null, initializeUnidimensionalArrayMethod);
call.overrideReturnType(arrayType);
call.addArgs(classLit, castableTypeMap, arrayElementRuntimeTypeReference, dim,
elementTypeCategory, program.getLiteralInt(arrayType.getDims()));
- ctx.replaceMe(call);
+ return call;
}
- private void processDims(JNewArray x, Context ctx, JArrayType arrayType) {
+ private JExpression initializeMultidimensionalArray(JNewArray x, JArrayType arrayType) {
// override the type of the called method with the array's type
SourceInfo sourceInfo = x.getSourceInfo();
JsonArray castableTypeMaps = new JsonArray(sourceInfo, program.getJavaScriptObject());
@@ -149,46 +152,45 @@
JsonArray dimList = new JsonArray(sourceInfo, program.getJavaScriptObject());
JType currentElementType = arrayType;
JLiteral classLit = x.getLeafTypeClassLiteral();
- for (int i = 0; i < x.dims.size(); ++i) {
+ for (int i = 0; i < x.getDimensionExpressions().size(); ++i) {
// Walk down each type from most dims to least.
JArrayType curArrayType = (JArrayType) currentElementType;
JExpression castableTypeMap = getOrCreateCastMap(sourceInfo, curArrayType);
- castableTypeMaps.getExprs().add(castableTypeMap);
+ castableTypeMaps.getExpressions().add(castableTypeMap);
JRuntimeTypeReference elementTypeIdLit = getElementRuntimeTypeReference(sourceInfo,
curArrayType);
- elementTypeReferences.getExprs().add(elementTypeIdLit);
+ elementTypeReferences.getExpressions().add(elementTypeIdLit);
- dimList.getExprs().add(x.dims.get(i));
+ dimList.getExpressions().add(x.getDimensionExpressions().get(i));
currentElementType = curArrayType.getElementType();
}
JType leafElementType = currentElementType;
JIntLiteral leafElementTypeCategory = getTypeCategoryLiteral(leafElementType);
- JMethodCall call = new JMethodCall(sourceInfo, null, initDims);
+ JMethodCall call =
+ new JMethodCall(sourceInfo, null, initializeMultidimensionalArrayMethod);
call.overrideReturnType(arrayType);
call.addArgs(classLit, castableTypeMaps, elementTypeReferences, leafElementTypeCategory,
- dimList, program.getLiteralInt(x.dims.size()));
- ctx.replaceMe(call);
+ dimList, program.getLiteralInt(x.getDimensionExpressions().size()));
+ return call;
}
- private void processInitializers(JNewArray x, Context ctx, JArrayType arrayType) {
+ private JExpression createArrayFromInitializers(JNewArray x, JArrayType arrayType) {
// override the type of the called method with the array's type
SourceInfo sourceInfo = x.getSourceInfo();
JExpression classLitExpression = program.createArrayClassLiteralExpression(x.getSourceInfo(),
x.getLeafTypeClassLiteral(), arrayType.getDims());
JExpression castableTypeMap = getOrCreateCastMap(sourceInfo, arrayType);
JRuntimeTypeReference elementTypeIds = getElementRuntimeTypeReference(sourceInfo, arrayType);
- JsonArray initList = new JsonArray(sourceInfo, program.getJavaScriptObject());
+ JsonArray initializers =
+ new JsonArray(sourceInfo, program.getJavaScriptObject(), x.getInitializers());
JIntLiteral leafElementTypeCategory = getTypeCategoryLiteral(arrayType.getElementType());
- for (int i = 0; i < x.initializers.size(); ++i) {
- initList.getExprs().add(x.initializers.get(i));
- }
- JMethodCall call = new JMethodCall(sourceInfo, null, initValues);
+ JMethodCall call = new JMethodCall(sourceInfo, null, stampJavaTypeInfoMethod);
call.overrideReturnType(arrayType);
call.addArgs(classLitExpression, castableTypeMap, elementTypeIds, leafElementTypeCategory,
- initList);
- ctx.replaceMe(call);
+ initializers);
+ return call;
}
/**
@@ -203,18 +205,20 @@
new ArrayNormalizer(program).execImpl();
}
- private final JMethod initDim;
- private final JMethod initDims;
- private final JMethod initValues;
- private final JProgram program;
+ private final JMethod initializeUnidimensionalArrayMethod;
+ private final JMethod initializeMultidimensionalArrayMethod;
+ private final JMethod stampJavaTypeInfoMethod;
private final JMethod setCheckMethod;
+ private final JProgram program;
private ArrayNormalizer(JProgram program) {
this.program = program;
setCheckMethod = program.getIndexedMethod(RuntimeConstants.ARRAY_SET_CHECK);
- initDim = program.getIndexedMethod(RuntimeConstants.ARRAY_INIT_DIM);
- initDims = program.getIndexedMethod(RuntimeConstants.ARRAY_INIT_DIMS);
- initValues = program.getIndexedMethod(RuntimeConstants.ARRAY_INIT_VALUES);
+ initializeUnidimensionalArrayMethod = program.getIndexedMethod(
+ RuntimeConstants.ARRAY_INITIALIZE_UNIDIMENSIONAL_ARRAY);
+ initializeMultidimensionalArrayMethod = program.getIndexedMethod(
+ RuntimeConstants.ARRAY_INITIALIZE_MULTIDIMENSIONAL_ARRAY);
+ stampJavaTypeInfoMethod = program.getIndexedMethod(RuntimeConstants.ARRAY_STAMP_JAVA_TYPE_INFO);
}
private void execImpl() {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java b/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java
index 11b91f2..d57a276 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/CloneExpressionVisitor.java
@@ -216,9 +216,9 @@
@Override
public boolean visit(JNewArray x, Context ctx) {
- expression =
- new JNewArray(x.getSourceInfo(), x.getArrayType(), cloneExpressions(x.dims),
- cloneExpressions(x.initializers), cloneExpression(x.getLeafTypeClassLiteral()));
+ expression = new JNewArray(x.getSourceInfo(), x.getArrayType(),
+ cloneExpressions(x.getDimensionExpressions()), cloneExpressions(x.getInitializers()),
+ cloneExpression(x.getLeafTypeClassLiteral()));
return false;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ComputePotentiallyObservableUninitializedValues.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ComputePotentiallyObservableUninitializedValues.java
index 5cd2f0a..e144f03 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ComputePotentiallyObservableUninitializedValues.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ComputePotentiallyObservableUninitializedValues.java
@@ -232,12 +232,12 @@
}
private boolean isDevirtualizedInitMethod(JMethod method) {
- return method.isStatic() && method.getName().equals(GwtAstBuilder.STATIC_INIT_NAME) &&
+ return method.isStatic() && method.getName().equals(GwtAstBuilder.STATIC_INIT_METHOD_NAME) &&
method.getEnclosingType() == currentClass;
}
private boolean isInitMethod(JMethod method) {
- return !method.isStatic() && method.getName().equals(GwtAstBuilder.INIT_NAME) &&
+ return !method.isStatic() && method.getName().equals(GwtAstBuilder.INIT_NAME_METHOD_NAME) &&
method.getEnclosingType() == currentClass;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
index 955550e..8b2710a 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ControlFlowAnalyzer.java
@@ -420,10 +420,10 @@
public boolean visit(JNewArray newArray, Context ctx) {
// rescue and instantiate the array type
JArrayType arrayType = newArray.getArrayType();
- if (newArray.dims != null) {
+ if (newArray.getDimensionExpressions() != null) {
// rescue my type and all the implicitly nested types (with fewer dims)
int arrayDimensions = arrayType.getDims();
- int initializedDimensions = newArray.dims.size();
+ int initializedDimensions = newArray.getDimensionExpressions().size();
JType leafType = arrayType.getLeafType();
assert (initializedDimensions <= arrayDimensions);
for (int i = 0; i < initializedDimensions; ++i) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/Devirtualizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/Devirtualizer.java
index 6cb8b5b..ece8574 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/Devirtualizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/Devirtualizer.java
@@ -355,8 +355,7 @@
/**
* Create a dispatch call taking the arguments from the devirtual method.
*/
- private static JMethodCall maybeCreateDispatch(JMethod dispatchTo,
- JMethod devirtualMethod) {
+ private static JMethodCall maybeCreateDispatch(JMethod dispatchTo, JMethod devirtualMethod) {
if (dispatchTo == null) {
return null;
}
@@ -369,8 +368,7 @@
thisParamRef = new JParameterRef(sourceInfo, parameters.remove(0));
}
- JMethodCall dispatchCall = new JMethodCall(sourceInfo, thisParamRef,
- dispatchTo);
+ JMethodCall dispatchCall = new JMethodCall(sourceInfo, thisParamRef, dispatchTo);
for (JParameter param : parameters) {
dispatchCall.addArg(new JParameterRef(sourceInfo, param));
}
@@ -415,8 +413,10 @@
}
}
- maybeCreateDispatchFor(method, DispatchType.JAVA_ARRAY, possibleTargetTypes,
- dispatchToMethodByTargetType, program.getTypeJavaLangObject());
+ if (possibleTargetTypes.contains(DispatchType.JAVA_ARRAY)) {
+ maybeCreateDispatchFor(method, DispatchType.JAVA_ARRAY, possibleTargetTypes,
+ dispatchToMethodByTargetType, program.getTypeJavaLangObject());
+ }
if (possibleTargetTypes.contains(DispatchType.JSO)) {
JMethod overridingMethod = findOverridingMethod(method,
@@ -500,7 +500,8 @@
dispatchExpression = constructMinimalCondition(
isJavaArray,
new JParameterRef(thisParam.getSourceInfo(), thisParam),
- maybeCreateDispatch(dispatchToMethodByTargetType.get(DispatchType.JAVA_ARRAY), devirtualMethod),
+ maybeCreateDispatch(dispatchToMethodByTargetType.get(DispatchType.JAVA_ARRAY),
+ devirtualMethod),
dispatchExpression);
// Dispatch to regular object
@@ -508,7 +509,8 @@
hasJavaObjectVirtualDispatch,
new JParameterRef(thisParam.getSourceInfo(), thisParam),
maybeCreateDispatch(
- dispatchToMethodByTargetType.get(DispatchType.HAS_JAVA_VIRTUAL_DISPATCH), devirtualMethod),
+ dispatchToMethodByTargetType.get(DispatchType.HAS_JAVA_VIRTUAL_DISPATCH),
+ devirtualMethod),
dispatchExpression);
// Dispatch to regular string, double, boolean
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java
index 71127dd..dbd4349 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/EnumOrdinalizer.java
@@ -443,12 +443,12 @@
public boolean visit(JNewArray x, Context ctx) {
// Do not visit the implicit Class literal.
- if (x.dims != null) {
- accept(x.dims);
+ if (x.getDimensionExpressions() != null) {
+ accept(x.getDimensionExpressions());
}
- if (x.initializers != null) {
- accept(x.initializers);
+ if (x.getInitializers() != null) {
+ accept(x.getInitializers());
}
return false;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java
index d8e0ead..9bfa6af 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ExpressionAnalyzer.java
@@ -182,7 +182,7 @@
* If no array bounds, the new array is being automatically initialized. If
* there are side-effects, they'll show up when we visit the initializers.
*/
- if (x.dims == null) {
+ if (x.getDimensionExpressions() == null) {
return;
}
@@ -190,7 +190,7 @@
* Can throw NegativeArraySizeException if we initialize an array with
* negative dimensions.
*/
- for (JExpression expression : x.dims) {
+ for (JExpression expression : x.getDimensionExpressions()) {
if (expression instanceof JIntLiteral) {
int value = ((JIntLiteral) expression).getValue();
if (value >= 0) {
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
index f0cfdda..228e434 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
@@ -1105,7 +1105,7 @@
@Override
public JsArrayLiteral transformJsonArray(JsonArray jsonArray) {
JsArrayLiteral jsArrayLiteral = new JsArrayLiteral(jsonArray.getSourceInfo());
- transformInto(jsonArray.getExprs(), jsArrayLiteral.getExpressions());
+ transformInto(jsonArray.getExpressions(), jsArrayLiteral.getExpressions());
return jsArrayLiteral;
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
index 4e3fd31..66fb82f 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
@@ -17,7 +17,6 @@
import com.google.gwt.dev.CompilerContext;
import com.google.gwt.dev.common.InliningMode;
-import com.google.gwt.dev.javac.JSORestrictionsChecker;
import com.google.gwt.dev.javac.JdtUtil;
import com.google.gwt.dev.javac.JsInteropUtil;
import com.google.gwt.dev.javac.JsniMethod;
@@ -249,10 +248,23 @@
*/
public class GwtAstBuilder {
- public static final String CLINIT_NAME = "$clinit";
- public static final String INIT_NAME = "$init";
- public static final String STATIC_INIT_NAME = "$" + INIT_NAME;
+ public static final String CLINIT_METHOD_NAME = "$clinit";
+ public static final String GET_CLASS_METHOD_NAME = "getClass";
+ public static final String HAS_NEXT_METHOD_NAME = "hasNext";
+ public static final String ITERATOR_METHOD_NAME = "iterator";
+ public static final String INIT_NAME_METHOD_NAME = "$init";
+ public static final String NEXT_METHOD_NAME = "next";
+ public static final String ORDINAL_METHOD_NAME = "ordinal";
public static final String OUTER_LAMBDA_PARAM_NAME = "$$outer_0";
+ public static final String STATIC_INIT_METHOD_NAME = "$" + INIT_NAME_METHOD_NAME;
+ public static final String VALUE_OF_METHOD_NAME = "valueOf";
+ public static final String VALUES_METHOD_NAME = "values";
+
+ public static final int CLINIT_METHOD_INDEX = 0;
+ public static final int INIT_METHOD_INDEX = 1;
+ public static final int GET_CLASS_METHOD_INDEX = 2;
+ public static final int VALUE_OF_METHOD_INDEX = 3;
+ public static final int VALUES_METHOD_INDEX = 4;
/**
* Visit the JDT AST and produce our own AST. By the end of this pass, the
@@ -260,7 +272,6 @@
* about the code. The JDT nodes should never again be referenced after this.
*/
class AstVisitor extends SafeASTVisitor {
-
/**
* Collects JSNI references from native method bodies and replaces the ones referring to
* compile time constants by their corresponding constant value.
@@ -849,7 +860,7 @@
JExpression instance = pop(x.receiver);
JExpression expr;
if (fieldBinding.declaringClass == null) {
- if (!ARRAY_LENGTH_FIELD.equals(String.valueOf(fieldBinding.name))) {
+ if (!LENGTH_FIELD_NAME.equals(String.valueOf(fieldBinding.name))) {
throw new InternalCompilerException("Expected [array].length.");
}
expr = new JArrayLength(info, instance);
@@ -952,9 +963,9 @@
CompilationUnitScope cudScope = scope.compilationUnitScope();
ReferenceBinding javaUtilIterator = scope.getJavaUtilIterator();
ReferenceBinding javaLangIterable = scope.getJavaLangIterable();
- MethodBinding iterator = javaLangIterable.getExactMethod(ITERATOR, NO_TYPES, cudScope);
- MethodBinding hasNext = javaUtilIterator.getExactMethod(HAS_NEXT, NO_TYPES, cudScope);
- MethodBinding next = javaUtilIterator.getExactMethod(NEXT, NO_TYPES, cudScope);
+ MethodBinding iterator = javaLangIterable.getExactMethod(ITERATOR_, NO_TYPES, cudScope);
+ MethodBinding hasNext = javaUtilIterator.getExactMethod(HAS_NEXT_, NO_TYPES, cudScope);
+ MethodBinding next = javaUtilIterator.getExactMethod(NEXT_, NO_TYPES, cudScope);
JLocal iteratorVar =
JProgram.createLocal(info, (elementVarName + "$iterator"), typeMap
.get(javaUtilIterator), false, curMethod.body);
@@ -1130,12 +1141,12 @@
return true;
}
- private void pushLambdaExpressionLocalsIntoMethodScope(LambdaExpression x, SyntheticArgumentBinding[] synthArgs,
- JMethod lambdaMethod) {
+ private void pushLambdaExpressionLocalsIntoMethodScope(LambdaExpression x,
+ SyntheticArgumentBinding[] syntheticArguments, JMethod lambdaMethod) {
Iterator<JParameter> it = lambdaMethod.getParams().iterator();
- if (synthArgs != null) {
+ if (syntheticArguments != null) {
MethodScope scope = x.getScope();
- for (SyntheticArgumentBinding sa : synthArgs) {
+ for (SyntheticArgumentBinding sa : syntheticArguments) {
VariableBinding[] path = scope.getEmulationPath(sa.actualOuterLocalVariable);
assert path.length == 1 && path[0] instanceof LocalVariableBinding;
JParameter param = it.next();
@@ -1148,16 +1159,17 @@
}
/**
- * Calculate the names of all the parameters a lambda method will need, that is, the combination of all
- * captured locals plus all arguments to the lambda expression.
+ * Calculate the names of all the parameters a lambda method will need, that is, the
+ * combination of all captured locals plus all arguments to the lambda expression.
*/
- private String[] computeCombinedParamNames(LambdaExpression x, SyntheticArgumentBinding[] synthArgs) {
+ private String[] computeCombinedParamNames(LambdaExpression x,
+ SyntheticArgumentBinding[] syntheticArguments) {
String[] paramNames;
paramNames = new String[x.binding.parameters.length];
- int numSynthArgs = synthArgs != null ? synthArgs.length : 0;
+ int numSynthArgs = syntheticArguments != null ? syntheticArguments.length : 0;
for (int i = 0; i < paramNames.length; i++) {
if (i < numSynthArgs) {
- paramNames[i] = nameForSyntheticArgument(synthArgs[i]);
+ paramNames[i] = nameForSyntheticArgument(syntheticArguments[i]);
} else {
paramNames[i] = nameForArgument(x.arguments, i - numSynthArgs, i);
}
@@ -1194,7 +1206,7 @@
* And replaces the lambda with new lambda$0$Type([outer this], captured locals...).
*/
- // The target accepting this lambda is looking for which type? (e.g. ClickHandler, Runnable, etc)
+ // The target accepting this lambda is looking for which type? (e.g. ClickHandler, Runnable)
TypeBinding binding = x.expectedType();
// Find the single abstract method of this interface
MethodBinding samBinding = binding.getSingleAbstractMethod(blockScope, false);
@@ -1461,15 +1473,16 @@
}
innerLambdaClass.setSuperClass(javaLangObject);
- createSyntheticMethod(info, CLINIT_NAME, innerLambdaClass, JPrimitiveType.VOID, false, true,
+ createSyntheticMethod(info, CLINIT_METHOD_NAME, innerLambdaClass, JPrimitiveType.VOID, false, true,
true, AccessModifier.PRIVATE);
- createSyntheticMethod(info, INIT_NAME, innerLambdaClass, JPrimitiveType.VOID, false, false,
+ createSyntheticMethod(info, INIT_NAME_METHOD_NAME, innerLambdaClass, JPrimitiveType.VOID, false, false,
true, AccessModifier.PRIVATE);
// Add a getClass() implementation for all non-Object classes.
- createSyntheticMethod(info, "getClass", innerLambdaClass, javaLangClass, false, false, false,
- AccessModifier.PUBLIC,new JClassLiteral(info, innerLambdaClass).makeReturnStatement());
+ createSyntheticMethod(info, GwtAstBuilder.GET_CLASS_METHOD_NAME, innerLambdaClass, javaLangClass,
+ false, false, false, AccessModifier.PUBLIC,
+ new JClassLiteral(info, innerLambdaClass).makeReturnStatement());
innerLambdaClass.setClassDisposition(JDeclaredType.NestedClassDisposition.LAMBDA);
return innerLambdaClass;
@@ -1658,7 +1671,7 @@
FieldBinding fieldBinding = x.otherBindings[i];
if (fieldBinding.declaringClass == null) {
// probably array.length
- if (!ARRAY_LENGTH_FIELD.equals(String.valueOf(fieldBinding.name))) {
+ if (!LENGTH_FIELD_NAME.equals(String.valueOf(fieldBinding.name))) {
throw new InternalCompilerException("Expected [array].length.");
}
curRef = new JArrayLength(info, curRef);
@@ -1741,7 +1754,8 @@
// Get the method that the Type::method is actually referring to
MethodBinding referredMethodBinding = x.binding;
if (referredMethodBinding instanceof SyntheticMethodBinding) {
- SyntheticMethodBinding synthRefMethodBinding = (SyntheticMethodBinding) referredMethodBinding;
+ SyntheticMethodBinding synthRefMethodBinding =
+ (SyntheticMethodBinding) referredMethodBinding;
if (synthRefMethodBinding.targetMethod != null) {
// generated in cases were a private method in an outer class needed to be called
// e.g. outer.access$0 calls some outer.private_method
@@ -2360,9 +2374,8 @@
if (isNested) {
NestedTypeBinding nestedBinding = (NestedTypeBinding) declaringClass;
if (nestedBinding.enclosingInstances != null) {
- for (int i = 0; i < nestedBinding.enclosingInstances.length; ++i) {
- SyntheticArgumentBinding arg = nestedBinding.enclosingInstances[i];
- curMethod.locals.put(arg, it.next());
+ for (SyntheticArgumentBinding argument : nestedBinding.enclosingInstances) {
+ curMethod.locals.put(argument, it.next());
}
}
}
@@ -2380,9 +2393,8 @@
NestedTypeBinding nestedBinding = (NestedTypeBinding) declaringClass;
// add synthetic args for outer this and locals
if (nestedBinding.outerLocalVariables != null) {
- for (int i = 0; i < nestedBinding.outerLocalVariables.length; ++i) {
- SyntheticArgumentBinding arg = nestedBinding.outerLocalVariables[i];
- curMethod.locals.put(arg, it.next());
+ for (SyntheticArgumentBinding argument : nestedBinding.outerLocalVariables) {
+ curMethod.locals.put(argument, it.next());
}
}
}
@@ -2526,7 +2538,7 @@
}
// Implement getClass() implementation for all non-Object classes.
- if (isSyntheticGetClassNeeded(x, type)) {
+ if (isSyntheticGetClassNeeded(x, type) && !type.isAbstract()) {
implementGetClass(type);
}
@@ -2646,20 +2658,18 @@
assert (type instanceof JClassType);
NestedTypeBinding nestedBinding = (NestedTypeBinding) binding;
if (nestedBinding.enclosingInstances != null) {
- for (int i = 0; i < nestedBinding.enclosingInstances.length; ++i) {
- SyntheticArgumentBinding arg = nestedBinding.enclosingInstances[i];
- createSyntheticField(arg, type, Disposition.THIS_REF);
+ for (SyntheticArgumentBinding argument : nestedBinding.enclosingInstances) {
+ createSyntheticField(argument, type, Disposition.THIS_REF);
}
}
if (nestedBinding.outerLocalVariables != null) {
- for (int i = 0; i < nestedBinding.outerLocalVariables.length; ++i) {
- SyntheticArgumentBinding arg = nestedBinding.outerLocalVariables[i];
+ for (SyntheticArgumentBinding argument : nestedBinding.outerLocalVariables) {
// See InnerClassTest.testOuterThisFromSuperCall().
boolean isReallyThisRef = false;
- if (arg.actualOuterLocalVariable instanceof SyntheticArgumentBinding) {
+ if (argument.actualOuterLocalVariable instanceof SyntheticArgumentBinding) {
SyntheticArgumentBinding outer =
- (SyntheticArgumentBinding) arg.actualOuterLocalVariable;
+ (SyntheticArgumentBinding) argument.actualOuterLocalVariable;
if (outer.matchingField != null) {
JField field = typeMap.get(outer.matchingField);
if (field.isThisRef()) {
@@ -2667,7 +2677,7 @@
}
}
}
- createSyntheticField(arg, type, isReallyThisRef ? Disposition.THIS_REF
+ createSyntheticField(argument, type, isReallyThisRef ? Disposition.THIS_REF
: Disposition.FINAL);
}
}
@@ -2733,9 +2743,8 @@
ClassScope scope = curClass.scope;
BaseTypeBinding primitiveType = (BaseTypeBinding) TypeBinding.wellKnownType(scope, typeId);
ReferenceBinding boxType = (ReferenceBinding) scope.boxing(primitiveType);
- MethodBinding valueOfMethod =
- boxType.getExactMethod(VALUE_OF, new TypeBinding[]{primitiveType}, scope
- .compilationUnitScope());
+ MethodBinding valueOfMethod = boxType.getExactMethod(VALUE_OF_,
+ new TypeBinding[]{primitiveType}, scope.compilationUnitScope());
assert valueOfMethod != null;
// Add a cast to the correct primitive type if needed.
@@ -2904,20 +2913,10 @@
* TODO(scottb): move to UnifyAst and only for non-abstract classes.
*/
private void implementGetClass(JDeclaredType type) {
- JMethod method = type.getMethods().get(2);
- assert ("getClass".equals(method.getName()));
+ JMethod method = type.getMethods().get(GET_CLASS_METHOD_INDEX);
+ assert (GwtAstBuilder.GET_CLASS_METHOD_NAME.equals(method.getName()));
SourceInfo info = method.getSourceInfo();
- if ("com.google.gwt.lang.Array".equals(type.getName())) {
- /*
- * Don't implement, fall through to Object.getClass(). Array emulation code
- * in com.google.gwt.lang.Array invokes Array.getClass() and expects to get the
- * class literal for the actual runtime type of the array (e.g. Foo[].class) and
- * not Array.class.
- */
- type.getMethods().remove(2);
- } else {
- JjsUtils.replaceMethodBody(method, new JClassLiteral(info, type));
- }
+ JjsUtils.replaceMethodBody(method, new JClassLiteral(info, type));
}
private JDeclarationStatement makeDeclaration(SourceInfo info, JLocal local,
@@ -3067,14 +3066,14 @@
private void processEnumType(JEnumType type) {
// $clinit, $init, getClass, valueOf, values
- JMethod valueOfMethod = type.getMethods().get(3);
- JMethod valuesMethod = type.getMethods().get(4);
+ JMethod valueOfMethod = type.getMethods().get(VALUE_OF_METHOD_INDEX);
+ JMethod valuesMethod = type.getMethods().get(VALUES_METHOD_INDEX);
{
- assert "valueOf".equals(valueOfMethod.getName());
+ assert VALUE_OF_METHOD_NAME.equals(valueOfMethod.getName());
writeEnumValueOfMethod(type, valueOfMethod, valuesMethod);
}
{
- assert "values".equals(valuesMethod.getName());
+ assert VALUES_METHOD_NAME.equals(valuesMethod.getName());
writeEnumValuesMethod(type, valuesMethod);
}
}
@@ -3139,7 +3138,8 @@
call.addArg(qualifier);
} else {
// Get implicit outer object.
- call.addArg(resolveThisReference(call.getSourceInfo(), targetType, false, curMethod.scope));
+ call.addArg(
+ resolveThisReference(call.getSourceInfo(), targetType, false, curMethod.scope));
}
}
}
@@ -3332,7 +3332,8 @@
return null;
}
assert path.length == 1;
- if (curMethod.scope.isInsideInitializer() && path[0] instanceof SyntheticArgumentBinding) {
+ if (curMethod.scope.isInsideInitializer()
+ && path[0] instanceof SyntheticArgumentBinding) {
SyntheticArgumentBinding sb = (SyntheticArgumentBinding) path[0];
JField field = curClass.syntheticFields.get(sb);
assert field != null;
@@ -3357,7 +3358,8 @@
assert field != null;
JExpression thisRef = null;
if (!b.isStatic()) {
- thisRef = resolveThisReference(info, (ReferenceBinding) x.actualReceiverType, false, scope);
+ thisRef =
+ resolveThisReference(info, (ReferenceBinding) x.actualReceiverType, false, scope);
}
result = new JFieldRef(info, thisRef, field, curClass.type);
} else {
@@ -3374,7 +3376,7 @@
private JExpression synthesizeCallToOrdinal(BlockScope scope, SourceInfo info,
JExpression expression) {
ReferenceBinding javaLangEnum = scope.getJavaLangEnum();
- MethodBinding ordinal = javaLangEnum.getMethods(ORDINAL)[0];
+ MethodBinding ordinal = javaLangEnum.getMethods(ORDINAL_)[0];
expression = new JMethodCall(info, expression, typeMap.get(ordinal));
return expression;
}
@@ -3398,7 +3400,7 @@
BaseTypeBinding primitiveType = (BaseTypeBinding) targetBinding;
ReferenceBinding boxType = (ReferenceBinding) scope.boxing(primitiveType);
- char[] selector = CharOperation.concat(primitiveType.simpleName, VALUE);
+ char[] selector = CharOperation.concat(primitiveType.simpleName, VALUE_SUFFIX_);
MethodBinding valueMethod =
boxType.getExactMethod(selector, NO_TYPES, scope.compilationUnitScope());
assert valueMethod != null;
@@ -3424,7 +3426,7 @@
mapClass.setEnclosingType(type);
newTypes.add(mapClass);
- MethodBinding[] createValueOfMapBindings = enumType.getMethods(CREATE_VALUE_OF_MAP);
+ MethodBinding[] createValueOfMapBindings = enumType.getMethods(CREATE_VALUE_OF_MAP_);
if (createValueOfMapBindings.length == 0) {
throw new RuntimeException(
"Unexpectedly unable to access Enum.createValueOfMap via reflection. "
@@ -3455,7 +3457,7 @@
SourceInfo info = method.getSourceInfo();
MethodBinding valueOfBinding =
- enumType.getExactMethod(VALUE_OF, new TypeBinding[]{
+ enumType.getExactMethod(VALUE_OF_, new TypeBinding[]{
mapType, curCud.scope.getJavaLangString()}, curCud.scope);
assert valueOfBinding != null;
@@ -3632,26 +3634,28 @@
* TODO(zundel): something much more awesome?
*/
private static final long AST_VERSION = 3;
- private static final char[] _STRING = "_String".toCharArray();
- private static final String ARRAY_LENGTH_FIELD = "length";
-
private static final int MAX_INLINEABLE_ENUM_SIZE = 10;
+ private static final String CREATE_VALUE_OF_MAP_METHOD_NAME = "createValueOfMap";
+ private static final String LENGTH_FIELD_NAME = "length";
+ private static final String VALUE_SUFFIX = "Value";
+
+ private static final char[] CREATE_VALUE_OF_MAP_ = CREATE_VALUE_OF_MAP_METHOD_NAME.toCharArray();
+ private static final char[] VALUE_SUFFIX_ = VALUE_SUFFIX.toCharArray();
+ private static final char[] VALUE_OF_ = VALUE_OF_METHOD_NAME.toCharArray();
+ private static final char[] VALUES_ = VALUES_METHOD_NAME.toCharArray();
+ private static final char[] ORDINAL_ = ORDINAL_METHOD_NAME.toCharArray();
+ private static final char[] NEXT_ = NEXT_METHOD_NAME.toCharArray();
+ private static final char[] ITERATOR_ = ITERATOR_METHOD_NAME.toCharArray();
+ private static final char[] HAS_NEXT_ = HAS_NEXT_METHOD_NAME.toCharArray();
+
/**
* Reflective access to {@link ForeachStatement#collectionElementType}.
*/
private static final Field collectionElementTypeField;
private static final Field haveReceiverField;
- private static final char[] CREATE_VALUE_OF_MAP = "createValueOfMap".toCharArray();
- private static final char[] HAS_NEXT = "hasNext".toCharArray();
- private static final char[] ITERATOR = "iterator".toCharArray();
- private static final char[] NEXT = "next".toCharArray();
- private static final TypeBinding[] NO_TYPES = new TypeBinding[0];
- private static final char[] ORDINAL = "ordinal".toCharArray();
private static final Interner<String> stringInterner = StringInterner.get();
- private static final char[] VALUE = "Value".toCharArray();
- private static final char[] VALUE_OF = "valueOf".toCharArray();
- private static final char[] VALUES = "values".toCharArray();
+ private static final TypeBinding[] NO_TYPES = new TypeBinding[0];
static {
InternalCompilerException.preload();
@@ -3923,35 +3927,35 @@
* like output JavaScript. Clinit is always in slot 0, init (if it exists)
* is always in slot 1.
*/
- assert type.getMethods().size() == 0;
- createSyntheticMethod(info, CLINIT_NAME, type, JPrimitiveType.VOID, false, true, true,
+ assert type.getMethods().size() == CLINIT_METHOD_INDEX;
+ createSyntheticMethod(info, CLINIT_METHOD_NAME, type, JPrimitiveType.VOID, false, true, true,
AccessModifier.PRIVATE);
if (type instanceof JClassType) {
- assert type.getMethods().size() == 1;
- createSyntheticMethod(info, INIT_NAME, type, JPrimitiveType.VOID, false, false, true,
+ assert type.getMethods().size() == INIT_METHOD_INDEX;
+ createSyntheticMethod(info, INIT_NAME_METHOD_NAME, type, JPrimitiveType.VOID, false, false, true,
AccessModifier.PRIVATE);
// Add a getClass() implementation for all non-Object, non-String classes.
if (isSyntheticGetClassNeeded(x, type)) {
- assert type.getMethods().size() == 2;
- createSyntheticMethod(info, "getClass", type, javaLangClass, false, false, false,
- AccessModifier.PUBLIC);
+ assert type.getMethods().size() == GET_CLASS_METHOD_INDEX;
+ createSyntheticMethod(info, GET_CLASS_METHOD_NAME, type, javaLangClass, type.isAbstract(), false,
+ false, AccessModifier.PUBLIC);
}
}
if (type instanceof JEnumType) {
{
- assert type.getMethods().size() == 3;
+ assert type.getMethods().size() == VALUE_OF_METHOD_INDEX;
MethodBinding valueOfBinding =
- binding.getExactMethod(VALUE_OF, new TypeBinding[]{x.scope.getJavaLangString()},
- curCud.scope);
+ binding.getExactMethod(VALUE_OF_,
+ new TypeBinding[]{x.scope.getJavaLangString()}, curCud.scope);
assert valueOfBinding != null;
createMethodFromBinding(info, valueOfBinding, new String[] {"name"});
}
{
- assert type.getMethods().size() == 4;
- MethodBinding valuesBinding = binding.getExactMethod(VALUES, NO_TYPES, curCud.scope);
+ assert type.getMethods().size() == VALUES_METHOD_INDEX;
+ MethodBinding valuesBinding = binding.getExactMethod(VALUES_, NO_TYPES, curCud.scope);
assert valuesBinding != null;
createMethodFromBinding(info, valuesBinding, null);
}
@@ -3987,7 +3991,7 @@
// TODO(rluble): We should check whether getClass is implemented by type and only
// instead of blacklisting.
return type != javaLangObject && type != javaLangString && type.getSuperClass() != null &&
- !JSORestrictionsChecker.isJsoSubclass(typeDeclaration.binding);
+ !JdtUtil.isJsoSubclass(typeDeclaration.binding);
}
private void createMethod(AbstractMethodDeclaration x) {
@@ -4101,7 +4105,8 @@
private void maybeSetHasNoSideEffects(AbstractMethodDeclaration x,
JMethod method) {
- if (JdtUtil.getAnnotation(x.binding, "javaemul.internal.annotations.HasNoSideEffects") != null) {
+ if (JdtUtil.getAnnotation(x.binding,
+ "javaemul.internal.annotations.HasNoSideEffects") != null) {
method.setHasSideEffects(false);
}
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java
index c193e39..e38793e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ImplicitUpcastAnalyzer.java
@@ -145,8 +145,8 @@
@Override
public void endVisit(JNewArray x, Context ctx) {
JType elementType = x.getArrayType().getElementType();
- if (x.initializers != null) {
- for (JExpression init : x.initializers) {
+ if (x.getInitializers() != null) {
+ for (JExpression init : x.getInitializers()) {
processIfTypesNotEqual(init.getType(), elementType, x.getSourceInfo());
}
}
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/LongCastNormalizer.java b/dev/core/src/com/google/gwt/dev/jjs/impl/LongCastNormalizer.java
index c4033fe..887564e 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/LongCastNormalizer.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/LongCastNormalizer.java
@@ -152,7 +152,7 @@
@Override
public void endVisit(JNewArray x, Context ctx) {
JType elementType = x.getArrayType().getElementType();
- List<JExpression> initializers = x.initializers;
+ List<JExpression> initializers = x.getInitializers();
if (initializers != null) {
for (int i = 0; i < initializers.size(); ++i) {
JExpression initializer = initializers.get(i);
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java
index 32b7381..dae5cfc 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ReferenceMapper.java
@@ -170,7 +170,7 @@
*/
}
// Emulate clinit method for super clinit calls.
- JMethod clinit = new JMethod(SourceOrigin.UNKNOWN, GwtAstBuilder.CLINIT_NAME, declType,
+ JMethod clinit = new JMethod(SourceOrigin.UNKNOWN, GwtAstBuilder.CLINIT_METHOD_NAME, declType,
JPrimitiveType.VOID, false, true, true, AccessModifier.PRIVATE);
clinit.freezeParamTypes();
clinit.setSynthetic();
diff --git a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
index e91e2b3..5c6027a 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/impl/ToStringGenerationVisitor.java
@@ -30,6 +30,7 @@
import com.google.gwt.dev.jjs.ast.JBooleanLiteral;
import com.google.gwt.dev.jjs.ast.JBreakStatement;
import com.google.gwt.dev.jjs.ast.JCaseStatement;
+import com.google.gwt.dev.jjs.ast.JCastMap;
import com.google.gwt.dev.jjs.ast.JCastOperation;
import com.google.gwt.dev.jjs.ast.JCharLiteral;
import com.google.gwt.dev.jjs.ast.JClassLiteral;
@@ -273,6 +274,14 @@
}
@Override
+ public boolean visit(JCastMap x, Context ctx) {
+ print('[');
+ visitCollectionWithCommas(x.getCanCastToTypes().iterator());
+ print(']');
+ return false;
+ }
+
+ @Override
public boolean visit(JCharLiteral x, Context ctx) {
printCharLiteral(x.getValue());
return false;
@@ -683,14 +692,14 @@
printTypeName(x.getArrayType().getLeafType());
for (int i = 0; i < x.getArrayType().getDims(); ++i) {
print('[');
- if (x.dims != null && x.dims.size() > i) {
- accept(x.dims.get(i));
+ if (x.getDimensionExpressions() != null && x.getDimensionExpressions().size() > i) {
+ accept(x.getDimensionExpressions().get(i));
}
print(']');
}
- if (x.initializers != null) {
+ if (x.getInitializers() != null) {
print(" {");
- visitCollectionWithCommas(x.initializers.iterator());
+ visitCollectionWithCommas(x.getInitializers().iterator());
print('}');
return false;
}
@@ -823,7 +832,7 @@
@Override
public boolean visit(JsonArray x, Context ctx) {
print('[');
- visitCollectionWithCommas(x.getExprs().iterator());
+ visitCollectionWithCommas(x.getExpressions().iterator());
print(']');
return false;
}
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java
index e35b162..b60bda5 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java
@@ -44,7 +44,7 @@
private static final int TYPE_PRIMITIVE_BOOLEAN = 12;
public static <T> T[] stampJavaTypeInfo(Object array, T[] referenceType) {
- initValues(referenceType.getClass(), Util.getCastableTypeMap(referenceType),
+ stampJavaTypeInfo(referenceType.getClass(), Util.getCastableTypeMap(referenceType),
Array.getElementTypeId(referenceType), Array.getElementTypeCategory(referenceType), array);
return Array.asArray(array);
}
@@ -67,10 +67,11 @@
* @param dimensions the number of dimensions of the array
* @return the new array
*/
- public static Object initDim(Class<?> leafClassLiteral, JavaScriptObject castableTypeMap,
- JavaScriptObject elementTypeId, int length, int elementTypeCategory, int dimensions) {
+ public static Object initUnidimensionalArray(Class<?> leafClassLiteral,
+ JavaScriptObject castableTypeMap, JavaScriptObject elementTypeId, int length,
+ int elementTypeCategory, int dimensions) {
Object result = initializeArrayElementsWithDefaults(elementTypeCategory, length);
- initValues(getClassLiteralForArray(leafClassLiteral, dimensions), castableTypeMap,
+ stampJavaTypeInfo(getClassLiteralForArray(leafClassLiteral, dimensions), castableTypeMap,
elementTypeId, elementTypeCategory, result);
return result;
}
@@ -92,9 +93,11 @@
* @param dimExprs the length of each dimension, from highest to lower
* @return the new array
*/
- public static Object initDims(Class<?> leafClassLiteral, JavaScriptObject[] castableTypeMapExprs,
+ public static Object initMultidimensionalArray(Class<?> leafClassLiteral,
+ JavaScriptObject[] castableTypeMapExprs,
JavaScriptObject[] elementTypeIds, int leafElementTypeCategory, int[] dimExprs, int count) {
- return initDims(leafClassLiteral, castableTypeMapExprs, elementTypeIds, leafElementTypeCategory,
+ return initMultidimensionalArray(leafClassLiteral, castableTypeMapExprs, elementTypeIds,
+ leafElementTypeCategory,
dimExprs, 0, count);
}
@@ -115,7 +118,7 @@
* @param array the JSON array that will be transformed into a GWT array
* @return values; having wrapped it for GWT
*/
- public static Object initValues(Class<?> arrayClass, JavaScriptObject castableTypeMap,
+ public static Object stampJavaTypeInfo(Class<?> arrayClass, JavaScriptObject castableTypeMap,
JavaScriptObject elementTypeId, int elementTypeCategory, Object array) {
setClass(array, arrayClass);
Util.setCastableTypeMap(array, castableTypeMap);
@@ -210,23 +213,23 @@
return array;
}-*/;
- private static Object initDims(Class<?> leafClassLiteral, JavaScriptObject[] castableTypeMapExprs,
- JavaScriptObject[] elementTypeIds, int leafElementTypeCategory, int[] dimExprs,
- int index, int count) {
+ private static Object initMultidimensionalArray(Class<?> leafClassLiteral,
+ JavaScriptObject[] castableTypeMapExprs, JavaScriptObject[] elementTypeIds,
+ int leafElementTypeCategory, int[] dimExprs, int index, int count) {
int length = dimExprs[index];
- boolean isLastDim = (index == (count - 1));
+ boolean isLastDimension = (index == (count - 1));
// All dimensions but the last are plain reference types.
- int elementTypeCategory = isLastDim ? leafElementTypeCategory : TYPE_JAVA_OBJECT;
+ int elementTypeCategory = isLastDimension ? leafElementTypeCategory : TYPE_JAVA_OBJECT;
Object result = initializeArrayElementsWithDefaults(elementTypeCategory, length);
- initValues(getClassLiteralForArray(leafClassLiteral, count - index),
+ stampJavaTypeInfo(getClassLiteralForArray(leafClassLiteral, count - index),
castableTypeMapExprs[index], elementTypeIds[index], elementTypeCategory, result);
- if (!isLastDim) {
+ if (!isLastDimension) {
// Recurse to next dimension.
++index;
for (int i = 0; i < length; ++i) {
- set(result, i, initDims(leafClassLiteral, castableTypeMapExprs,
+ set(result, i, initMultidimensionalArray(leafClassLiteral, castableTypeMapExprs,
elementTypeIds, leafElementTypeCategory, dimExprs, index, count));
}
}
@@ -243,6 +246,14 @@
return getClassLiteralForArrayImpl(clazz, dimensions);
}
+ private static native int getElementTypeCategory(Object array) /*-{
+ return array.__elementTypeCategory$;
+ }-*/;
+
+ private static native JavaScriptObject getElementTypeId(Object array) /*-{
+ return array.__elementTypeId$;
+ }-*/;
+
// DO NOT INLINE this method into {@link getClassLiteralForArray}.
// The purpose of this method is to avoid introducing a public api to {@link java.lang.Class}.
private static native <T> Class<T> getClassLiteralForArrayImpl(
@@ -266,18 +277,10 @@
array.__elementTypeId$ = elementTypeId;
}-*/;
- private static native JavaScriptObject getElementTypeId(Object array) /*-{
- return array.__elementTypeId$;
- }-*/;
-
private static native void setElementTypeCategory(Object array, int elementTypeCategory) /*-{
array.__elementTypeCategory$ = elementTypeCategory;
}-*/;
- private static native int getElementTypeCategory(Object array) /*-{
- return array.__elementTypeCategory$;
- }-*/;
-
private Array() {
}
}
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
index 84f3022..98956b8 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Cast.java
@@ -47,14 +47,16 @@
@HasNoSideEffects
static native boolean canCast(Object src, JavaScriptObject dstId) /*-{
- return @com.google.gwt.lang.Cast::instanceOfString(*)(src) &&
- !!@com.google.gwt.lang.Cast::stringCastMap[dstId] ||
- src.@java.lang.Object::castableTypeMap && !!src.@java.lang.Object::castableTypeMap[dstId] ||
- @com.google.gwt.lang.Cast::instanceOfDouble(*)(src) &&
- !!@com.google.gwt.lang.Cast::doubleCastMap[dstId] ||
- // this occurs last because it is much rarer and less likely to be in hot code
- @com.google.gwt.lang.Cast::instanceOfBoolean(*)(src) &&
- !!@com.google.gwt.lang.Cast::booleanCastMap[dstId];
+ if (@com.google.gwt.lang.Cast::instanceOfString(*)(src)) {
+ return !!@com.google.gwt.lang.Cast::stringCastMap[dstId]
+ } else if (src.@java.lang.Object::castableTypeMap) {
+ return !!src.@java.lang.Object::castableTypeMap[dstId]
+ } else if (@com.google.gwt.lang.Cast::instanceOfDouble(*)(src)) {
+ return !!@com.google.gwt.lang.Cast::doubleCastMap[dstId];
+ } else if (@com.google.gwt.lang.Cast::instanceOfBoolean(*)(src)) {
+ return !!@com.google.gwt.lang.Cast::booleanCastMap[dstId];
+ }
+ return false;
}-*/;
@HasNoSideEffects
diff --git a/dev/core/super/javaemul/internal/ArrayStamper.java b/dev/core/super/javaemul/internal/ArrayStamper.java
index a6a9ed2..53d2f48 100644
--- a/dev/core/super/javaemul/internal/ArrayStamper.java
+++ b/dev/core/super/javaemul/internal/ArrayStamper.java
@@ -20,6 +20,7 @@
*/
class ArrayStamper {
public static native <T> T[] stampJavaTypeInfo(Object array, T[] referenceType) /*-{
- return @com.google.gwt.lang.Array::stampJavaTypeInfo(*)(array, referenceType);
+ return @com.google.gwt.lang.Array::stampJavaTypeInfo(
+ Ljava/lang/Object;[Ljava/lang/Object;)(array, referenceType);;
}-*/;
}
diff --git a/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java b/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
index 2bf9eef..4438ee9 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/JavaAstConstructor.java
@@ -62,11 +62,13 @@
"import com.google.gwt.core.client.JavaScriptObject;",
"public final class Array {",
" static void setCheck(Object array, int index, Object value) { }",
- " static void initDim(Class arrayClass, JavaScriptObject castableTypeMap,",
+ " static void initUnidimensionalArray(",
+ " Class arrayClass, JavaScriptObject castableTypeMap,",
" int elementTypeId, int elementTypeCategory, int length) { }",
- " static void initDims(Class arrayClasses[], JavaScriptObject[] castableTypeMapExprs,",
+ " static void initMultidimensionalArray(",
+ " Class arrayClasses[], JavaScriptObject[] castableTypeMapExprs,",
" int[] elementTypeIds, int leafElementTypeCategory, int[] dimExprs, int count) { }",
- " static void initValues(Class arrayClass, JavaScriptObject castableTypeMap,",
+ " static void stampJavaTypeInfo(Class arrayClass, JavaScriptObject castableTypeMap,",
" int elementTypeId, int elementTypeCategory, Object array) { }",
" static <T> Class<T> getClassLiteralForArray() { return null; }",
"}"
@@ -91,7 +93,7 @@
" public static Object castToString(Object src) { return src;}",
" public static Object castToDouble(Object src) { return src;}",
" public static Object castToBoolean(Object src) { return src;}",
- " public static Object castToNative(Object src, int dstId, String jsType) { return src;}",
+ " public static Object castToNative(Object src, int dstId, String type) { return src;}",
" public static Object castToUnknownNative(Object src) { return src;}",
" public static Object castToFunction(Object src) { return src; }",
" public static boolean hasJavaObjectVirtualDispatch(Object o) { return true; }",
@@ -102,7 +104,8 @@
" public static boolean instanceOfAllowJso(Object src, int dst) { return false;}",
" public static boolean instanceOfJso(Object src) { return false;}",
" public static boolean instanceOfUnknownNative(Object src) { return false;}",
- " public static boolean instanceOfNative(Object src, JavaScriptObject dstId, String jsType) { return false;}",
+ " public static boolean instanceOfNative(Object src, ",
+ " JavaScriptObject dstId, String type) { return false;}",
" public static boolean instanceOfFunction(Object src) { return false; }",
" public static boolean isJavaArray(Object o) { return false; }",
" public static boolean isJavaScriptObject(Object o) { return true; }",
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/ArrayNormalizerTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/ArrayNormalizerTest.java
index 6ecb89c..af1eae9 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/ArrayNormalizerTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/ArrayNormalizerTest.java
@@ -29,7 +29,7 @@
Result result =
optimize("void", "A[] a = new A[1]; a[1] = new A();");
result.intoString(
- "EntryPoint$A[] a = Array.initDim(EntryPoint$A.class, , " +
+ "EntryPoint$A[] a = Array.initUnidimensionalArray(EntryPoint$A.class, [], " +
"/* JRuntimeTypeReference */\"test.EntryPoint$A\", 1, 0, 1);",
"a[1] = new EntryPoint$A();");
}
@@ -41,9 +41,9 @@
Result result =
optimize("void", "A[] a = new A[1]; a = new B[1]; a[1] = new A();");
result.intoString(
- "EntryPoint$A[] a = Array.initDim(EntryPoint$A.class, , " +
+ "EntryPoint$A[] a = Array.initUnidimensionalArray(EntryPoint$A.class, [], " +
"/* JRuntimeTypeReference */\"test.EntryPoint$A\", 1, 0, 1);",
- "a = Array.initDim(EntryPoint$B.class, , " +
+ "a = Array.initUnidimensionalArray(EntryPoint$B.class, [], " +
"/* JRuntimeTypeReference */\"test.EntryPoint$B\", 1, 0, 1);",
"Array.setCheck(a, 1, new EntryPoint$A());");
}
diff --git a/dev/core/test/com/google/gwt/dev/jjs/impl/JChangeTrackingVisitorTest.java b/dev/core/test/com/google/gwt/dev/jjs/impl/JChangeTrackingVisitorTest.java
index ac25619..62c677f 100644
--- a/dev/core/test/com/google/gwt/dev/jjs/impl/JChangeTrackingVisitorTest.java
+++ b/dev/core/test/com/google/gwt/dev/jjs/impl/JChangeTrackingVisitorTest.java
@@ -500,7 +500,7 @@
Set<JMethod> modifiedMethodsInIteration1 =
ImmutableSet.copyOf(getMethods(program, "test.EntryPoint$A",
- "fun2", "fun3", "fun5", GwtAstBuilder.CLINIT_NAME));
+ "fun2", "fun3", "fun5", GwtAstBuilder.CLINIT_METHOD_NAME));
Set<JField> modifiedFieldsInIteration1 =
ImmutableSet.copyOf(getFields(program, "test.EntryPoint$A",
"staticField"));
@@ -516,7 +516,7 @@
Set<JMethod> modifiedMethodsInIteration2 =
ImmutableSet.copyOf(getMethods(program, "test.EntryPoint$A",
- "fun4", "fun5", GwtAstBuilder.INIT_NAME));
+ "fun4", "fun5", GwtAstBuilder.INIT_NAME_METHOD_NAME));
Set<JField> modifiedFieldsInIteration2 =
ImmutableSet.copyOf(getFields(program, "test.EntryPoint$A",
"instanceField", "field"));