Set the superclass of the value map inner class to be Object. Every class deserves to have a superclass.
Review by: scottb@google.com
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@8227 8db76d5a-ed1c-0410-87a9-c151d255dfc7
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 0969d62..bf45e4c 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
@@ -2036,7 +2036,7 @@
JMethod bridgeMethod = program.createMethod(info,
String.valueOf(jdtBridgeMethod.selector), clazz,
(JType) typeMap.get(jdtBridgeMethod.returnType.erasure()), false,
- false, true, false, false);
+ false, implmeth.isFinal(), false, false);
bridgeMethod.setSynthetic();
int paramIdx = 0;
List<JParameter> implParams = implmeth.getParams();
@@ -2750,6 +2750,7 @@
JavaASTGenerationVisitor.class, "Enum$Map");
JClassType mapClass = program.createClass(sourceInfo, type.getName()
+ "$Map", false, true);
+ mapClass.setSuperClass(program.getTypeJavaLangObject());
mapField = program.createField(sourceInfo, "$MAP", mapClass,
program.getJavaScriptObject(), true, Disposition.FINAL);
@@ -2804,7 +2805,16 @@
JDeclarationStatement declStmt = new JDeclarationStatement(sourceInfo,
valuesRef, newExpr);
JBlock clinitBlock = ((JMethodBody) type.getMethods().get(0).getBody()).getBlock();
- clinitBlock.addStmt(declStmt);
+
+ /*
+ * HACKY: the $VALUES array must be initialized immediately after all of
+ * the enum fields, but before any user initialization (which might rely
+ * on $VALUES). The "1 + " is the statement containing the call to
+ * Enum.$clinit().
+ */
+ int insertionPoint = 1 + initializers.size();
+ assert clinitBlock.getStatements().size() >= initializers.size() + 1;
+ clinitBlock.addStmt(insertionPoint, declStmt);
valuesField.setInitializer(declStmt);
}
{