Change handling of edge case.

Generally speaking, you can't create an instance of a class before
the class is initialized.  When you're talking about java.lang.Class
itself, this doesn't apply.  We were trying to sneak in a just-in-time
initialization, but the recent addition of SMP-mandated opcode rewrites
screwed things up a bit.

Happily, the creation of the java.lang.Class class object now happens
at a known time, which means we can explicitly initialize the class
at the right time (when it's far enough along to be able to execute
the class initializer, but before anything tries to use a virtual
method or instance field in java.lang.Class).

Also, changed a LOGE+abort to a simple assert.  The test in question is
performed earlier during linking, so this doesn't merit more than an
assertion.

Bug 3045762.

Change-Id: Ifffb5083a3de108e1d91b3de7b75fd5e97705912
diff --git a/vm/Init.c b/vm/Init.c
index aa6b98a..7cf5b54 100644
--- a/vm/Init.c
+++ b/vm/Init.c
@@ -1295,6 +1295,16 @@
         goto fail;
 
     /*
+     * Explicitly initialize java.lang.Class.  This doesn't happen
+     * automatically because it's allocated specially (it's an instance
+     * of itself).  Must happen before registration of system natives,
+     * which make some calls that throw assertions if the classes they
+     * operate on aren't initialized.
+     */
+    if (!dvmInitClass(gDvm.classJavaLangClass))
+        goto fail;
+
+    /*
      * Register the system native methods, which are registered through JNI.
      */
     if (!registerSystemNatives(pEnv))