Implement EntryMethodHolder.init in source.

Stub out EntryMethodHolder.init() so we can use the existing empty method instead of having to create it from whole cloth.

http://gwt-code-reviews.appspot.com/1421803/


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@10039 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
index 0c19f94..ec64583 100644
--- a/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
+++ b/dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
@@ -872,7 +872,7 @@
     return dependencyRecorder;
   }
 
-  private static JMethodCall createReboundModuleLoad(TreeLogger logger,
+  private static JMethodCall createReboundModuleLoad(TreeLogger logger, SourceInfo info,
       JDeclaredType reboundEntryType, String originalMainClassName, JDeclaredType enclosingType)
       throws UnableToCompleteException {
     if (!(reboundEntryType instanceof JClassType)) {
@@ -902,10 +902,9 @@
       throw new UnableToCompleteException();
     }
 
-    SourceInfo sourceInfo = entryClass.getSourceInfo();
     JExpression qualifier = null;
     if (!entryMethod.isStatic()) {
-      qualifier = JGwtCreate.createInstantiationExpression(sourceInfo, entryClass, enclosingType);
+      qualifier = JGwtCreate.createInstantiationExpression(info, entryClass, enclosingType);
 
       if (qualifier == null) {
         logger.log(TreeLogger.ERROR,
@@ -915,21 +914,17 @@
         throw new UnableToCompleteException();
       }
     }
-    return new JMethodCall(sourceInfo, qualifier, entryMethod);
+    return new JMethodCall(info, qualifier, entryMethod);
   }
 
   private static void findEntryPoints(TreeLogger logger, RebindPermutationOracle rpo,
       String[] mainClassNames, JProgram program) throws UnableToCompleteException {
     Event findEntryPointsEvent = SpeedTracerLogger.start(CompilerEventType.FIND_ENTRY_POINTS);
-    SourceInfo sourceInfo = program.createSourceInfoSynthetic(JavaToJavaScriptCompiler.class);
-    JMethod bootStrapMethod =
-        program.createMethod(sourceInfo, "init", program.getIndexedType("EntryMethodHolder"),
-            program.getTypeVoid(), false, true, true, false, false);
-    bootStrapMethod.freezeParamTypes();
-    bootStrapMethod.setSynthetic();
+    JMethod bootStrapMethod = program.getIndexedMethod("EntryMethodHolder.init");
 
     JMethodBody body = (JMethodBody) bootStrapMethod.getBody();
     JBlock block = body.getBlock();
+    SourceInfo info = block.getSourceInfo().makeChild();
 
     // Also remember $entry, which we'll handle specially in GenerateJsAst
     JMethod registerEntry = program.getIndexedMethod("Impl.registerEntry");
@@ -947,7 +942,7 @@
 
       JMethod mainMethod = findMainMethod(mainType);
       if (mainMethod != null && mainMethod.isStatic()) {
-        JMethodCall onModuleLoadCall = new JMethodCall(null, null, mainMethod);
+        JMethodCall onModuleLoadCall = new JMethodCall(info, null, mainMethod);
         block.addStmt(onModuleLoadCall.makeStatement());
         continue;
       }
@@ -965,7 +960,7 @@
         }
 
         JMethodCall onModuleLoadCall =
-            createReboundModuleLoad(logger, resultType, mainClassName, bootStrapMethod
+            createReboundModuleLoad(logger, info, resultType, mainClassName, bootStrapMethod
                 .getEnclosingType());
         resultTypes.add((JClassType) resultType);
         entryCalls.add(onModuleLoadCall);
@@ -974,7 +969,7 @@
         block.addStmt(entryCalls.get(0).makeStatement());
       } else {
         JReboundEntryPoint reboundEntryPoint =
-            new JReboundEntryPoint(mainType.getSourceInfo(), mainType, resultTypes, entryCalls);
+            new JReboundEntryPoint(info, mainType, resultTypes, entryCalls);
         block.addStmt(reboundEntryPoint);
       }
     }
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
index 8464c59..2590881 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
@@ -19,5 +19,7 @@
  * This class holds the boot strap entry method that the compiler generates.
  */
 public class EntryMethodHolder {
-
+  public static final void init() {
+    // Filled in by the compiler to call entry methods.
+  }
 }