Tweak art tests to decouple better from toolchain version.

This CL changes some nested classes to be prebuilt rather
than compiled each time the test is run so they don't
depend on javac behavior, which changed between OpenJDK 8
and OpenJDK 9. This way, the tests pass when run on either
OpenJDK 8 or 9.

The class files were generated using OpenJDK 8 javac and
converted to jasmin (.j) using ClassFileAnalyzer 0.7.0 [1]
and Jasper 1.00 [2], respectively; license headers and
comments were added to the generated .j files.

[1] http://classfileanalyzer.javaseiten.de/
[2] http://www.angelfire.com/tx4/cus/jasper/

031-class-attributes:
  Unlike OpenJDK 8 javac, OpenJDK 9 javac does not consider
  an anonymous class declared inside a static method to be
  static. This affects ClassAttr$1.j, which is now prebuilt.

085-old-style-inner-class:
  Main$1 and Main$2 relied on compilation with javac
  -source 1.4 -target 1.4, which OpenJDK 9 javac doesn't
  support. They are now prebuilt. The two classes are
  identical in all relevant aspects; a future CL could
  simplify the test by dropping one of them.

Bug: 69449021
Test: The two tests touched by this CL pass in:
      EXPERIMENTAL_USE_OPENJDK9=1.8 \
      art/test/testrunner/run_build_test_target.py -j40 art-interpreter

Change-Id: I72ba88eb6325a641876b7143008dfb209a16047e
diff --git a/test/031-class-attributes/jasmin/ClassAttrs$1.j b/test/031-class-attributes/jasmin/ClassAttrs$1.j
new file mode 100644
index 0000000..ea767ef
--- /dev/null
+++ b/test/031-class-attributes/jasmin/ClassAttrs$1.j
@@ -0,0 +1,49 @@
+; Copyright (C) 2017 The Android Open Source Project
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;      http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+; (new OtherClass() { int i = 5; }).getClass()
+
+; ClassAttrs$1.j
+
+; Generated by ClassFileAnalyzer (Can)
+; Analyzer and Disassembler for Java class files
+; (Jasmin syntax 2, http://jasmin.sourceforge.net)
+;
+; ClassFileAnalyzer, version 0.7.0
+
+.bytecode 52.0
+.source ClassAttrs.java
+.class final ClassAttrs$1
+.super OtherClass
+.enclosing method ClassAttrs/main()V
+; OpenJDK javac versions <= 8 consider anonymous classes declared side
+; static methods to be static (as is this one), whereas OpenJDK 9 javac
+; does not. See http://b/62290080
+.inner class static inner ClassAttrs$1 ; <anonymous> <not a member>
+
+.field i I
+
+.method <init>()V
+  .limit stack 2
+  .limit locals 1
+  .line 112
+  0: aload_0
+  1: invokespecial OtherClass/<init>()V
+  4: aload_0
+  5: iconst_5
+  6: putfield ClassAttrs$1/i I
+  9: return
+.end method
+
+
diff --git a/test/031-class-attributes/src/ClassAttrs.java b/test/031-class-attributes/src/ClassAttrs.java
index 8489a2c..f55a34c 100644
--- a/test/031-class-attributes/src/ClassAttrs.java
+++ b/test/031-class-attributes/src/ClassAttrs.java
@@ -107,9 +107,14 @@
         inner.showMe();
 
         ClassAttrs attrs = new ClassAttrs();
-
-        /* anonymous, not local, not member */
-        printClassAttrs((new OtherClass() { int i = 5; }).getClass());
+        try {
+            /* anonymous, not local, not member */
+            printClassAttrs(Class.forName("ClassAttrs$1")); // ClassAttrs$1.j
+        } catch (ClassNotFoundException e) {
+            System.out.println("FAILED: " + e);
+            e.printStackTrace(System.out);
+            throw new AssertionError(e);
+        }
 
         /* member, not anonymous, not local */
         printClassAttrs(MemberClass.class);
diff --git a/test/085-old-style-inner-class/build b/test/085-old-style-inner-class/build
deleted file mode 100644
index 21dc662..0000000
--- a/test/085-old-style-inner-class/build
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-#
-# Copyright (C) 2010 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Stop if something fails.
-set -e
-
-# We compile for a 1.4 target to suppress the use of EnclosingMethod
-# attributes.
-mkdir classes
-${JAVAC} -source 1.4 -target 1.4 -d classes `find src -name '*.java'`
-
-if [ ${USE_JACK} = "true" ]; then
-  jar cf classes.jill.jar -C classes .
-  ${JACK} --import classes.jill.jar --output-dex .
-else
-  # Suppress stderr to keep the inner class warnings out of the expected output.
-  ${DX} --debug --dex --dump-to=classes.lst --output=classes.dex --dump-width=1000 classes 2>/dev/null
-fi
-
-zip $TEST_NAME.jar classes.dex
diff --git a/test/085-old-style-inner-class/jasmin/Main$1.j b/test/085-old-style-inner-class/jasmin/Main$1.j
new file mode 100644
index 0000000..fde1dde
--- /dev/null
+++ b/test/085-old-style-inner-class/jasmin/Main$1.j
@@ -0,0 +1,39 @@
+; Copyright (C) 2017 The Android Open Source Project
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;      http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+.source                  Main.java
+.class                   final Main$1
+.super                   java/lang/Object
+.implements              java/lang/Runnable
+
+; new Runnable() {
+;   public void run() { }
+; };
+
+.method                  <init>()V
+   .limit stack          1
+   .limit locals         1
+   .line                 23
+   aload_0
+   invokespecial         java/lang/Object/<init>()V
+   return
+.end method
+
+.method                  public run()V
+   .limit stack          0
+   .limit locals         1
+   .line                 24
+   return
+.end method
+
diff --git a/test/085-old-style-inner-class/jasmin/Main$2.j b/test/085-old-style-inner-class/jasmin/Main$2.j
new file mode 100644
index 0000000..dedbe86
--- /dev/null
+++ b/test/085-old-style-inner-class/jasmin/Main$2.j
@@ -0,0 +1,39 @@
+; Copyright (C) 2017 The Android Open Source Project
+;
+; Licensed under the Apache License, Version 2.0 (the "License");
+; you may not use this file except in compliance with the License.
+; You may obtain a copy of the License at
+;
+;      http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+
+.source                  Main.java
+.class                   final Main$2
+.super                   java/lang/Object
+.implements              java/lang/Runnable
+
+; new Runnable() {
+;   public void run() { }
+; };
+
+.method                  <init>()V
+   .limit stack          1
+   .limit locals         1
+   .line                 28
+   aload_0
+   invokespecial         java/lang/Object/<init>()V
+   return
+.end method
+
+.method                  public run()V
+   .limit stack          0
+   .limit locals         1
+   .line                 29
+   return
+.end method
+
diff --git a/test/085-old-style-inner-class/src/Main.java b/test/085-old-style-inner-class/src/Main.java
index c9a5b72..831364c 100644
--- a/test/085-old-style-inner-class/src/Main.java
+++ b/test/085-old-style-inner-class/src/Main.java
@@ -20,15 +20,19 @@
  * Test reflection on old-style inner classes.
  */
 public class Main {
+    /*
+    // Main$1.j
     private static Runnable theRunnable = new Runnable() {
             public void run() { }
         };
 
+    // Main$1.2
     private static Runnable create() {
         return new Runnable() {
                 public void run() { }
             };
     }
+    */
 
     private static String nameOf(Class clazz) {
         return (clazz == null) ? "(null)" : clazz.getName();
@@ -48,8 +52,8 @@
                 nameOf(clazz.getEnclosingMethod()));
     }
 
-    public static void main(String args[]) {
-        infoFor(theRunnable.getClass());
-        infoFor(create().getClass());
+    public static void main(String args[]) throws ClassNotFoundException {
+        infoFor(Class.forName("Main$1"));
+        infoFor(Class.forName("Main$2"));
     }
 }