Merge "Replace libziparchive-host with libziparchive"
diff --git a/benchmarks/src/benchmarks/ImtConflictBenchmark.java b/benchmarks/src/benchmarks/ImtConflictBenchmark.java
new file mode 100644
index 0000000..faff03d
--- /dev/null
+++ b/benchmarks/src/benchmarks/ImtConflictBenchmark.java
@@ -0,0 +1,1706 @@
+/*
+ * Copyright 2016 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.
+ */
+
+package benchmarks;
+import com.google.caliper.BeforeExperiment;
+
+/**
+ * This file is script-generated by ImtConflictBenchmarkGen.py.
+ * It measures the performance impact of conflicts in interface method tables.
+ * Run `python ImtConflictBenchmarkGen.py > ImtConflictBenchmark.java` to regenerate.
+ *
+ * Each interface has 64 methods, which is the current size of an IMT. C0 implements
+ * one interface, C1 implements two, C2 implements three, and so on. The intent
+ * is that C0 has no conflicts in its IMT, C1 has depth-2 conflicts in
+ * its IMT, C2 has depth-3 conflicts, etc. This is currently guaranteed by
+ * the fact that we hash interface methods by taking their method index modulo 64.
+ * (Note that a "conflict depth" of 1 means no conflict at all.)
+ */
+public class ImtConflictBenchmark {
+    @BeforeExperiment
+    public void setup() {
+        C0 c0 = new C0();
+        callF0(c0);
+        C1 c1 = new C1();
+        callF0(c1);
+        callF43(c1);
+        C2 c2 = new C2();
+        callF0(c2);
+        callF43(c2);
+        callF86(c2);
+        C3 c3 = new C3();
+        callF0(c3);
+        callF43(c3);
+        callF86(c3);
+        callF129(c3);
+        C4 c4 = new C4();
+        callF0(c4);
+        callF43(c4);
+        callF86(c4);
+        callF129(c4);
+        callF172(c4);
+        C5 c5 = new C5();
+        callF0(c5);
+        callF43(c5);
+        callF86(c5);
+        callF129(c5);
+        callF172(c5);
+        callF215(c5);
+        C6 c6 = new C6();
+        callF0(c6);
+        callF43(c6);
+        callF86(c6);
+        callF129(c6);
+        callF172(c6);
+        callF215(c6);
+        callF258(c6);
+        C7 c7 = new C7();
+        callF0(c7);
+        callF43(c7);
+        callF86(c7);
+        callF129(c7);
+        callF172(c7);
+        callF215(c7);
+        callF258(c7);
+        callF301(c7);
+        C8 c8 = new C8();
+        callF0(c8);
+        callF43(c8);
+        callF86(c8);
+        callF129(c8);
+        callF172(c8);
+        callF215(c8);
+        callF258(c8);
+        callF301(c8);
+        callF344(c8);
+        C9 c9 = new C9();
+        callF0(c9);
+        callF43(c9);
+        callF86(c9);
+        callF129(c9);
+        callF172(c9);
+        callF215(c9);
+        callF258(c9);
+        callF301(c9);
+        callF344(c9);
+        callF387(c9);
+        C10 c10 = new C10();
+        callF0(c10);
+        callF43(c10);
+        callF86(c10);
+        callF129(c10);
+        callF172(c10);
+        callF215(c10);
+        callF258(c10);
+        callF301(c10);
+        callF344(c10);
+        callF387(c10);
+        callF430(c10);
+        C11 c11 = new C11();
+        callF0(c11);
+        callF43(c11);
+        callF86(c11);
+        callF129(c11);
+        callF172(c11);
+        callF215(c11);
+        callF258(c11);
+        callF301(c11);
+        callF344(c11);
+        callF387(c11);
+        callF430(c11);
+        callF473(c11);
+        C12 c12 = new C12();
+        callF0(c12);
+        callF43(c12);
+        callF86(c12);
+        callF129(c12);
+        callF172(c12);
+        callF215(c12);
+        callF258(c12);
+        callF301(c12);
+        callF344(c12);
+        callF387(c12);
+        callF430(c12);
+        callF473(c12);
+        callF516(c12);
+        C13 c13 = new C13();
+        callF0(c13);
+        callF43(c13);
+        callF86(c13);
+        callF129(c13);
+        callF172(c13);
+        callF215(c13);
+        callF258(c13);
+        callF301(c13);
+        callF344(c13);
+        callF387(c13);
+        callF430(c13);
+        callF473(c13);
+        callF516(c13);
+        callF559(c13);
+        C14 c14 = new C14();
+        callF0(c14);
+        callF43(c14);
+        callF86(c14);
+        callF129(c14);
+        callF172(c14);
+        callF215(c14);
+        callF258(c14);
+        callF301(c14);
+        callF344(c14);
+        callF387(c14);
+        callF430(c14);
+        callF473(c14);
+        callF516(c14);
+        callF559(c14);
+        callF602(c14);
+        C15 c15 = new C15();
+        callF0(c15);
+        callF43(c15);
+        callF86(c15);
+        callF129(c15);
+        callF172(c15);
+        callF215(c15);
+        callF258(c15);
+        callF301(c15);
+        callF344(c15);
+        callF387(c15);
+        callF430(c15);
+        callF473(c15);
+        callF516(c15);
+        callF559(c15);
+        callF602(c15);
+        callF645(c15);
+        C16 c16 = new C16();
+        callF0(c16);
+        callF43(c16);
+        callF86(c16);
+        callF129(c16);
+        callF172(c16);
+        callF215(c16);
+        callF258(c16);
+        callF301(c16);
+        callF344(c16);
+        callF387(c16);
+        callF430(c16);
+        callF473(c16);
+        callF516(c16);
+        callF559(c16);
+        callF602(c16);
+        callF645(c16);
+        callF688(c16);
+        C17 c17 = new C17();
+        callF0(c17);
+        callF43(c17);
+        callF86(c17);
+        callF129(c17);
+        callF172(c17);
+        callF215(c17);
+        callF258(c17);
+        callF301(c17);
+        callF344(c17);
+        callF387(c17);
+        callF430(c17);
+        callF473(c17);
+        callF516(c17);
+        callF559(c17);
+        callF602(c17);
+        callF645(c17);
+        callF688(c17);
+        callF731(c17);
+        C18 c18 = new C18();
+        callF0(c18);
+        callF43(c18);
+        callF86(c18);
+        callF129(c18);
+        callF172(c18);
+        callF215(c18);
+        callF258(c18);
+        callF301(c18);
+        callF344(c18);
+        callF387(c18);
+        callF430(c18);
+        callF473(c18);
+        callF516(c18);
+        callF559(c18);
+        callF602(c18);
+        callF645(c18);
+        callF688(c18);
+        callF731(c18);
+        callF774(c18);
+        C19 c19 = new C19();
+        callF0(c19);
+        callF43(c19);
+        callF86(c19);
+        callF129(c19);
+        callF172(c19);
+        callF215(c19);
+        callF258(c19);
+        callF301(c19);
+        callF344(c19);
+        callF387(c19);
+        callF430(c19);
+        callF473(c19);
+        callF516(c19);
+        callF559(c19);
+        callF602(c19);
+        callF645(c19);
+        callF688(c19);
+        callF731(c19);
+        callF774(c19);
+        callF817(c19);
+    }
+    public void timeConflictDepth01(int nreps) {
+        C0 c0 = new C0();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+            callF0(c0);
+        }
+    }
+    public void timeConflictDepth02(int nreps) {
+        C1 c1 = new C1();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+            callF0(c1);
+            callF43(c1);
+        }
+    }
+    public void timeConflictDepth03(int nreps) {
+        C2 c2 = new C2();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c2);
+            callF43(c2);
+            callF86(c2);
+            callF0(c2);
+            callF43(c2);
+            callF86(c2);
+            callF0(c2);
+            callF43(c2);
+            callF86(c2);
+            callF0(c2);
+            callF43(c2);
+            callF86(c2);
+            callF0(c2);
+            callF43(c2);
+            callF86(c2);
+            callF0(c2);
+            callF43(c2);
+            callF86(c2);
+            callF0(c2);
+            callF43(c2);
+        }
+    }
+    public void timeConflictDepth04(int nreps) {
+        C3 c3 = new C3();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c3);
+            callF43(c3);
+            callF86(c3);
+            callF129(c3);
+            callF0(c3);
+            callF43(c3);
+            callF86(c3);
+            callF129(c3);
+            callF0(c3);
+            callF43(c3);
+            callF86(c3);
+            callF129(c3);
+            callF0(c3);
+            callF43(c3);
+            callF86(c3);
+            callF129(c3);
+            callF0(c3);
+            callF43(c3);
+            callF86(c3);
+            callF129(c3);
+        }
+    }
+    public void timeConflictDepth05(int nreps) {
+        C4 c4 = new C4();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c4);
+            callF43(c4);
+            callF86(c4);
+            callF129(c4);
+            callF172(c4);
+            callF0(c4);
+            callF43(c4);
+            callF86(c4);
+            callF129(c4);
+            callF172(c4);
+            callF0(c4);
+            callF43(c4);
+            callF86(c4);
+            callF129(c4);
+            callF172(c4);
+            callF0(c4);
+            callF43(c4);
+            callF86(c4);
+            callF129(c4);
+            callF172(c4);
+        }
+    }
+    public void timeConflictDepth06(int nreps) {
+        C5 c5 = new C5();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c5);
+            callF43(c5);
+            callF86(c5);
+            callF129(c5);
+            callF172(c5);
+            callF215(c5);
+            callF0(c5);
+            callF43(c5);
+            callF86(c5);
+            callF129(c5);
+            callF172(c5);
+            callF215(c5);
+            callF0(c5);
+            callF43(c5);
+            callF86(c5);
+            callF129(c5);
+            callF172(c5);
+            callF215(c5);
+            callF0(c5);
+            callF43(c5);
+        }
+    }
+    public void timeConflictDepth07(int nreps) {
+        C6 c6 = new C6();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c6);
+            callF43(c6);
+            callF86(c6);
+            callF129(c6);
+            callF172(c6);
+            callF215(c6);
+            callF258(c6);
+            callF0(c6);
+            callF43(c6);
+            callF86(c6);
+            callF129(c6);
+            callF172(c6);
+            callF215(c6);
+            callF258(c6);
+            callF0(c6);
+            callF43(c6);
+            callF86(c6);
+            callF129(c6);
+            callF172(c6);
+            callF215(c6);
+        }
+    }
+    public void timeConflictDepth08(int nreps) {
+        C7 c7 = new C7();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c7);
+            callF43(c7);
+            callF86(c7);
+            callF129(c7);
+            callF172(c7);
+            callF215(c7);
+            callF258(c7);
+            callF301(c7);
+            callF0(c7);
+            callF43(c7);
+            callF86(c7);
+            callF129(c7);
+            callF172(c7);
+            callF215(c7);
+            callF258(c7);
+            callF301(c7);
+            callF0(c7);
+            callF43(c7);
+            callF86(c7);
+            callF129(c7);
+        }
+    }
+    public void timeConflictDepth09(int nreps) {
+        C8 c8 = new C8();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c8);
+            callF43(c8);
+            callF86(c8);
+            callF129(c8);
+            callF172(c8);
+            callF215(c8);
+            callF258(c8);
+            callF301(c8);
+            callF344(c8);
+            callF0(c8);
+            callF43(c8);
+            callF86(c8);
+            callF129(c8);
+            callF172(c8);
+            callF215(c8);
+            callF258(c8);
+            callF301(c8);
+            callF344(c8);
+            callF0(c8);
+            callF43(c8);
+        }
+    }
+    public void timeConflictDepth10(int nreps) {
+        C9 c9 = new C9();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c9);
+            callF43(c9);
+            callF86(c9);
+            callF129(c9);
+            callF172(c9);
+            callF215(c9);
+            callF258(c9);
+            callF301(c9);
+            callF344(c9);
+            callF387(c9);
+            callF0(c9);
+            callF43(c9);
+            callF86(c9);
+            callF129(c9);
+            callF172(c9);
+            callF215(c9);
+            callF258(c9);
+            callF301(c9);
+            callF344(c9);
+            callF387(c9);
+        }
+    }
+    public void timeConflictDepth11(int nreps) {
+        C10 c10 = new C10();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c10);
+            callF43(c10);
+            callF86(c10);
+            callF129(c10);
+            callF172(c10);
+            callF215(c10);
+            callF258(c10);
+            callF301(c10);
+            callF344(c10);
+            callF387(c10);
+            callF430(c10);
+            callF0(c10);
+            callF43(c10);
+            callF86(c10);
+            callF129(c10);
+            callF172(c10);
+            callF215(c10);
+            callF258(c10);
+            callF301(c10);
+            callF344(c10);
+        }
+    }
+    public void timeConflictDepth12(int nreps) {
+        C11 c11 = new C11();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c11);
+            callF43(c11);
+            callF86(c11);
+            callF129(c11);
+            callF172(c11);
+            callF215(c11);
+            callF258(c11);
+            callF301(c11);
+            callF344(c11);
+            callF387(c11);
+            callF430(c11);
+            callF473(c11);
+            callF0(c11);
+            callF43(c11);
+            callF86(c11);
+            callF129(c11);
+            callF172(c11);
+            callF215(c11);
+            callF258(c11);
+            callF301(c11);
+        }
+    }
+    public void timeConflictDepth13(int nreps) {
+        C12 c12 = new C12();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c12);
+            callF43(c12);
+            callF86(c12);
+            callF129(c12);
+            callF172(c12);
+            callF215(c12);
+            callF258(c12);
+            callF301(c12);
+            callF344(c12);
+            callF387(c12);
+            callF430(c12);
+            callF473(c12);
+            callF516(c12);
+            callF0(c12);
+            callF43(c12);
+            callF86(c12);
+            callF129(c12);
+            callF172(c12);
+            callF215(c12);
+            callF258(c12);
+        }
+    }
+    public void timeConflictDepth14(int nreps) {
+        C13 c13 = new C13();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c13);
+            callF43(c13);
+            callF86(c13);
+            callF129(c13);
+            callF172(c13);
+            callF215(c13);
+            callF258(c13);
+            callF301(c13);
+            callF344(c13);
+            callF387(c13);
+            callF430(c13);
+            callF473(c13);
+            callF516(c13);
+            callF559(c13);
+            callF0(c13);
+            callF43(c13);
+            callF86(c13);
+            callF129(c13);
+            callF172(c13);
+            callF215(c13);
+        }
+    }
+    public void timeConflictDepth15(int nreps) {
+        C14 c14 = new C14();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c14);
+            callF43(c14);
+            callF86(c14);
+            callF129(c14);
+            callF172(c14);
+            callF215(c14);
+            callF258(c14);
+            callF301(c14);
+            callF344(c14);
+            callF387(c14);
+            callF430(c14);
+            callF473(c14);
+            callF516(c14);
+            callF559(c14);
+            callF602(c14);
+            callF0(c14);
+            callF43(c14);
+            callF86(c14);
+            callF129(c14);
+            callF172(c14);
+        }
+    }
+    public void timeConflictDepth16(int nreps) {
+        C15 c15 = new C15();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c15);
+            callF43(c15);
+            callF86(c15);
+            callF129(c15);
+            callF172(c15);
+            callF215(c15);
+            callF258(c15);
+            callF301(c15);
+            callF344(c15);
+            callF387(c15);
+            callF430(c15);
+            callF473(c15);
+            callF516(c15);
+            callF559(c15);
+            callF602(c15);
+            callF645(c15);
+            callF0(c15);
+            callF43(c15);
+            callF86(c15);
+            callF129(c15);
+        }
+    }
+    public void timeConflictDepth17(int nreps) {
+        C16 c16 = new C16();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c16);
+            callF43(c16);
+            callF86(c16);
+            callF129(c16);
+            callF172(c16);
+            callF215(c16);
+            callF258(c16);
+            callF301(c16);
+            callF344(c16);
+            callF387(c16);
+            callF430(c16);
+            callF473(c16);
+            callF516(c16);
+            callF559(c16);
+            callF602(c16);
+            callF645(c16);
+            callF688(c16);
+            callF0(c16);
+            callF43(c16);
+            callF86(c16);
+        }
+    }
+    public void timeConflictDepth18(int nreps) {
+        C17 c17 = new C17();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c17);
+            callF43(c17);
+            callF86(c17);
+            callF129(c17);
+            callF172(c17);
+            callF215(c17);
+            callF258(c17);
+            callF301(c17);
+            callF344(c17);
+            callF387(c17);
+            callF430(c17);
+            callF473(c17);
+            callF516(c17);
+            callF559(c17);
+            callF602(c17);
+            callF645(c17);
+            callF688(c17);
+            callF731(c17);
+            callF0(c17);
+            callF43(c17);
+        }
+    }
+    public void timeConflictDepth19(int nreps) {
+        C18 c18 = new C18();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c18);
+            callF43(c18);
+            callF86(c18);
+            callF129(c18);
+            callF172(c18);
+            callF215(c18);
+            callF258(c18);
+            callF301(c18);
+            callF344(c18);
+            callF387(c18);
+            callF430(c18);
+            callF473(c18);
+            callF516(c18);
+            callF559(c18);
+            callF602(c18);
+            callF645(c18);
+            callF688(c18);
+            callF731(c18);
+            callF774(c18);
+            callF0(c18);
+        }
+    }
+    public void timeConflictDepth20(int nreps) {
+        C19 c19 = new C19();
+        for (int i = 0; i < nreps; i++) {
+            callF0(c19);
+            callF43(c19);
+            callF86(c19);
+            callF129(c19);
+            callF172(c19);
+            callF215(c19);
+            callF258(c19);
+            callF301(c19);
+            callF344(c19);
+            callF387(c19);
+            callF430(c19);
+            callF473(c19);
+            callF516(c19);
+            callF559(c19);
+            callF602(c19);
+            callF645(c19);
+            callF688(c19);
+            callF731(c19);
+            callF774(c19);
+            callF817(c19);
+        }
+    }
+    public void callF0(I0 i) { i.f0(); }
+    public void callF43(I1 i) { i.f43(); }
+    public void callF86(I2 i) { i.f86(); }
+    public void callF129(I3 i) { i.f129(); }
+    public void callF172(I4 i) { i.f172(); }
+    public void callF215(I5 i) { i.f215(); }
+    public void callF258(I6 i) { i.f258(); }
+    public void callF301(I7 i) { i.f301(); }
+    public void callF344(I8 i) { i.f344(); }
+    public void callF387(I9 i) { i.f387(); }
+    public void callF430(I10 i) { i.f430(); }
+    public void callF473(I11 i) { i.f473(); }
+    public void callF516(I12 i) { i.f516(); }
+    public void callF559(I13 i) { i.f559(); }
+    public void callF602(I14 i) { i.f602(); }
+    public void callF645(I15 i) { i.f645(); }
+    public void callF688(I16 i) { i.f688(); }
+    public void callF731(I17 i) { i.f731(); }
+    public void callF774(I18 i) { i.f774(); }
+    public void callF817(I19 i) { i.f817(); }
+    static class C0 implements I0 {}
+    static class C1 implements I0, I1 {}
+    static class C2 implements I0, I1, I2 {}
+    static class C3 implements I0, I1, I2, I3 {}
+    static class C4 implements I0, I1, I2, I3, I4 {}
+    static class C5 implements I0, I1, I2, I3, I4, I5 {}
+    static class C6 implements I0, I1, I2, I3, I4, I5, I6 {}
+    static class C7 implements I0, I1, I2, I3, I4, I5, I6, I7 {}
+    static class C8 implements I0, I1, I2, I3, I4, I5, I6, I7, I8 {}
+    static class C9 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9 {}
+    static class C10 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10 {}
+    static class C11 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11 {}
+    static class C12 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12 {}
+    static class C13 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13 {}
+    static class C14 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14 {}
+    static class C15 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15 {}
+    static class C16 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16 {}
+    static class C17 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, I17 {}
+    static class C18 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, I17, I18 {}
+    static class C19 implements I0, I1, I2, I3, I4, I5, I6, I7, I8, I9, I10, I11, I12, I13, I14, I15, I16, I17, I18, I19 {}
+    static interface I0 {
+        default void f0() {}
+        default void f1() {}
+        default void f2() {}
+        default void f3() {}
+        default void f4() {}
+        default void f5() {}
+        default void f6() {}
+        default void f7() {}
+        default void f8() {}
+        default void f9() {}
+        default void f10() {}
+        default void f11() {}
+        default void f12() {}
+        default void f13() {}
+        default void f14() {}
+        default void f15() {}
+        default void f16() {}
+        default void f17() {}
+        default void f18() {}
+        default void f19() {}
+        default void f20() {}
+        default void f21() {}
+        default void f22() {}
+        default void f23() {}
+        default void f24() {}
+        default void f25() {}
+        default void f26() {}
+        default void f27() {}
+        default void f28() {}
+        default void f29() {}
+        default void f30() {}
+        default void f31() {}
+        default void f32() {}
+        default void f33() {}
+        default void f34() {}
+        default void f35() {}
+        default void f36() {}
+        default void f37() {}
+        default void f38() {}
+        default void f39() {}
+        default void f40() {}
+        default void f41() {}
+        default void f42() {}
+    }
+    static interface I1 {
+        default void f43() {}
+        default void f44() {}
+        default void f45() {}
+        default void f46() {}
+        default void f47() {}
+        default void f48() {}
+        default void f49() {}
+        default void f50() {}
+        default void f51() {}
+        default void f52() {}
+        default void f53() {}
+        default void f54() {}
+        default void f55() {}
+        default void f56() {}
+        default void f57() {}
+        default void f58() {}
+        default void f59() {}
+        default void f60() {}
+        default void f61() {}
+        default void f62() {}
+        default void f63() {}
+        default void f64() {}
+        default void f65() {}
+        default void f66() {}
+        default void f67() {}
+        default void f68() {}
+        default void f69() {}
+        default void f70() {}
+        default void f71() {}
+        default void f72() {}
+        default void f73() {}
+        default void f74() {}
+        default void f75() {}
+        default void f76() {}
+        default void f77() {}
+        default void f78() {}
+        default void f79() {}
+        default void f80() {}
+        default void f81() {}
+        default void f82() {}
+        default void f83() {}
+        default void f84() {}
+        default void f85() {}
+    }
+    static interface I2 {
+        default void f86() {}
+        default void f87() {}
+        default void f88() {}
+        default void f89() {}
+        default void f90() {}
+        default void f91() {}
+        default void f92() {}
+        default void f93() {}
+        default void f94() {}
+        default void f95() {}
+        default void f96() {}
+        default void f97() {}
+        default void f98() {}
+        default void f99() {}
+        default void f100() {}
+        default void f101() {}
+        default void f102() {}
+        default void f103() {}
+        default void f104() {}
+        default void f105() {}
+        default void f106() {}
+        default void f107() {}
+        default void f108() {}
+        default void f109() {}
+        default void f110() {}
+        default void f111() {}
+        default void f112() {}
+        default void f113() {}
+        default void f114() {}
+        default void f115() {}
+        default void f116() {}
+        default void f117() {}
+        default void f118() {}
+        default void f119() {}
+        default void f120() {}
+        default void f121() {}
+        default void f122() {}
+        default void f123() {}
+        default void f124() {}
+        default void f125() {}
+        default void f126() {}
+        default void f127() {}
+        default void f128() {}
+    }
+    static interface I3 {
+        default void f129() {}
+        default void f130() {}
+        default void f131() {}
+        default void f132() {}
+        default void f133() {}
+        default void f134() {}
+        default void f135() {}
+        default void f136() {}
+        default void f137() {}
+        default void f138() {}
+        default void f139() {}
+        default void f140() {}
+        default void f141() {}
+        default void f142() {}
+        default void f143() {}
+        default void f144() {}
+        default void f145() {}
+        default void f146() {}
+        default void f147() {}
+        default void f148() {}
+        default void f149() {}
+        default void f150() {}
+        default void f151() {}
+        default void f152() {}
+        default void f153() {}
+        default void f154() {}
+        default void f155() {}
+        default void f156() {}
+        default void f157() {}
+        default void f158() {}
+        default void f159() {}
+        default void f160() {}
+        default void f161() {}
+        default void f162() {}
+        default void f163() {}
+        default void f164() {}
+        default void f165() {}
+        default void f166() {}
+        default void f167() {}
+        default void f168() {}
+        default void f169() {}
+        default void f170() {}
+        default void f171() {}
+    }
+    static interface I4 {
+        default void f172() {}
+        default void f173() {}
+        default void f174() {}
+        default void f175() {}
+        default void f176() {}
+        default void f177() {}
+        default void f178() {}
+        default void f179() {}
+        default void f180() {}
+        default void f181() {}
+        default void f182() {}
+        default void f183() {}
+        default void f184() {}
+        default void f185() {}
+        default void f186() {}
+        default void f187() {}
+        default void f188() {}
+        default void f189() {}
+        default void f190() {}
+        default void f191() {}
+        default void f192() {}
+        default void f193() {}
+        default void f194() {}
+        default void f195() {}
+        default void f196() {}
+        default void f197() {}
+        default void f198() {}
+        default void f199() {}
+        default void f200() {}
+        default void f201() {}
+        default void f202() {}
+        default void f203() {}
+        default void f204() {}
+        default void f205() {}
+        default void f206() {}
+        default void f207() {}
+        default void f208() {}
+        default void f209() {}
+        default void f210() {}
+        default void f211() {}
+        default void f212() {}
+        default void f213() {}
+        default void f214() {}
+    }
+    static interface I5 {
+        default void f215() {}
+        default void f216() {}
+        default void f217() {}
+        default void f218() {}
+        default void f219() {}
+        default void f220() {}
+        default void f221() {}
+        default void f222() {}
+        default void f223() {}
+        default void f224() {}
+        default void f225() {}
+        default void f226() {}
+        default void f227() {}
+        default void f228() {}
+        default void f229() {}
+        default void f230() {}
+        default void f231() {}
+        default void f232() {}
+        default void f233() {}
+        default void f234() {}
+        default void f235() {}
+        default void f236() {}
+        default void f237() {}
+        default void f238() {}
+        default void f239() {}
+        default void f240() {}
+        default void f241() {}
+        default void f242() {}
+        default void f243() {}
+        default void f244() {}
+        default void f245() {}
+        default void f246() {}
+        default void f247() {}
+        default void f248() {}
+        default void f249() {}
+        default void f250() {}
+        default void f251() {}
+        default void f252() {}
+        default void f253() {}
+        default void f254() {}
+        default void f255() {}
+        default void f256() {}
+        default void f257() {}
+    }
+    static interface I6 {
+        default void f258() {}
+        default void f259() {}
+        default void f260() {}
+        default void f261() {}
+        default void f262() {}
+        default void f263() {}
+        default void f264() {}
+        default void f265() {}
+        default void f266() {}
+        default void f267() {}
+        default void f268() {}
+        default void f269() {}
+        default void f270() {}
+        default void f271() {}
+        default void f272() {}
+        default void f273() {}
+        default void f274() {}
+        default void f275() {}
+        default void f276() {}
+        default void f277() {}
+        default void f278() {}
+        default void f279() {}
+        default void f280() {}
+        default void f281() {}
+        default void f282() {}
+        default void f283() {}
+        default void f284() {}
+        default void f285() {}
+        default void f286() {}
+        default void f287() {}
+        default void f288() {}
+        default void f289() {}
+        default void f290() {}
+        default void f291() {}
+        default void f292() {}
+        default void f293() {}
+        default void f294() {}
+        default void f295() {}
+        default void f296() {}
+        default void f297() {}
+        default void f298() {}
+        default void f299() {}
+        default void f300() {}
+    }
+    static interface I7 {
+        default void f301() {}
+        default void f302() {}
+        default void f303() {}
+        default void f304() {}
+        default void f305() {}
+        default void f306() {}
+        default void f307() {}
+        default void f308() {}
+        default void f309() {}
+        default void f310() {}
+        default void f311() {}
+        default void f312() {}
+        default void f313() {}
+        default void f314() {}
+        default void f315() {}
+        default void f316() {}
+        default void f317() {}
+        default void f318() {}
+        default void f319() {}
+        default void f320() {}
+        default void f321() {}
+        default void f322() {}
+        default void f323() {}
+        default void f324() {}
+        default void f325() {}
+        default void f326() {}
+        default void f327() {}
+        default void f328() {}
+        default void f329() {}
+        default void f330() {}
+        default void f331() {}
+        default void f332() {}
+        default void f333() {}
+        default void f334() {}
+        default void f335() {}
+        default void f336() {}
+        default void f337() {}
+        default void f338() {}
+        default void f339() {}
+        default void f340() {}
+        default void f341() {}
+        default void f342() {}
+        default void f343() {}
+    }
+    static interface I8 {
+        default void f344() {}
+        default void f345() {}
+        default void f346() {}
+        default void f347() {}
+        default void f348() {}
+        default void f349() {}
+        default void f350() {}
+        default void f351() {}
+        default void f352() {}
+        default void f353() {}
+        default void f354() {}
+        default void f355() {}
+        default void f356() {}
+        default void f357() {}
+        default void f358() {}
+        default void f359() {}
+        default void f360() {}
+        default void f361() {}
+        default void f362() {}
+        default void f363() {}
+        default void f364() {}
+        default void f365() {}
+        default void f366() {}
+        default void f367() {}
+        default void f368() {}
+        default void f369() {}
+        default void f370() {}
+        default void f371() {}
+        default void f372() {}
+        default void f373() {}
+        default void f374() {}
+        default void f375() {}
+        default void f376() {}
+        default void f377() {}
+        default void f378() {}
+        default void f379() {}
+        default void f380() {}
+        default void f381() {}
+        default void f382() {}
+        default void f383() {}
+        default void f384() {}
+        default void f385() {}
+        default void f386() {}
+    }
+    static interface I9 {
+        default void f387() {}
+        default void f388() {}
+        default void f389() {}
+        default void f390() {}
+        default void f391() {}
+        default void f392() {}
+        default void f393() {}
+        default void f394() {}
+        default void f395() {}
+        default void f396() {}
+        default void f397() {}
+        default void f398() {}
+        default void f399() {}
+        default void f400() {}
+        default void f401() {}
+        default void f402() {}
+        default void f403() {}
+        default void f404() {}
+        default void f405() {}
+        default void f406() {}
+        default void f407() {}
+        default void f408() {}
+        default void f409() {}
+        default void f410() {}
+        default void f411() {}
+        default void f412() {}
+        default void f413() {}
+        default void f414() {}
+        default void f415() {}
+        default void f416() {}
+        default void f417() {}
+        default void f418() {}
+        default void f419() {}
+        default void f420() {}
+        default void f421() {}
+        default void f422() {}
+        default void f423() {}
+        default void f424() {}
+        default void f425() {}
+        default void f426() {}
+        default void f427() {}
+        default void f428() {}
+        default void f429() {}
+    }
+    static interface I10 {
+        default void f430() {}
+        default void f431() {}
+        default void f432() {}
+        default void f433() {}
+        default void f434() {}
+        default void f435() {}
+        default void f436() {}
+        default void f437() {}
+        default void f438() {}
+        default void f439() {}
+        default void f440() {}
+        default void f441() {}
+        default void f442() {}
+        default void f443() {}
+        default void f444() {}
+        default void f445() {}
+        default void f446() {}
+        default void f447() {}
+        default void f448() {}
+        default void f449() {}
+        default void f450() {}
+        default void f451() {}
+        default void f452() {}
+        default void f453() {}
+        default void f454() {}
+        default void f455() {}
+        default void f456() {}
+        default void f457() {}
+        default void f458() {}
+        default void f459() {}
+        default void f460() {}
+        default void f461() {}
+        default void f462() {}
+        default void f463() {}
+        default void f464() {}
+        default void f465() {}
+        default void f466() {}
+        default void f467() {}
+        default void f468() {}
+        default void f469() {}
+        default void f470() {}
+        default void f471() {}
+        default void f472() {}
+    }
+    static interface I11 {
+        default void f473() {}
+        default void f474() {}
+        default void f475() {}
+        default void f476() {}
+        default void f477() {}
+        default void f478() {}
+        default void f479() {}
+        default void f480() {}
+        default void f481() {}
+        default void f482() {}
+        default void f483() {}
+        default void f484() {}
+        default void f485() {}
+        default void f486() {}
+        default void f487() {}
+        default void f488() {}
+        default void f489() {}
+        default void f490() {}
+        default void f491() {}
+        default void f492() {}
+        default void f493() {}
+        default void f494() {}
+        default void f495() {}
+        default void f496() {}
+        default void f497() {}
+        default void f498() {}
+        default void f499() {}
+        default void f500() {}
+        default void f501() {}
+        default void f502() {}
+        default void f503() {}
+        default void f504() {}
+        default void f505() {}
+        default void f506() {}
+        default void f507() {}
+        default void f508() {}
+        default void f509() {}
+        default void f510() {}
+        default void f511() {}
+        default void f512() {}
+        default void f513() {}
+        default void f514() {}
+        default void f515() {}
+    }
+    static interface I12 {
+        default void f516() {}
+        default void f517() {}
+        default void f518() {}
+        default void f519() {}
+        default void f520() {}
+        default void f521() {}
+        default void f522() {}
+        default void f523() {}
+        default void f524() {}
+        default void f525() {}
+        default void f526() {}
+        default void f527() {}
+        default void f528() {}
+        default void f529() {}
+        default void f530() {}
+        default void f531() {}
+        default void f532() {}
+        default void f533() {}
+        default void f534() {}
+        default void f535() {}
+        default void f536() {}
+        default void f537() {}
+        default void f538() {}
+        default void f539() {}
+        default void f540() {}
+        default void f541() {}
+        default void f542() {}
+        default void f543() {}
+        default void f544() {}
+        default void f545() {}
+        default void f546() {}
+        default void f547() {}
+        default void f548() {}
+        default void f549() {}
+        default void f550() {}
+        default void f551() {}
+        default void f552() {}
+        default void f553() {}
+        default void f554() {}
+        default void f555() {}
+        default void f556() {}
+        default void f557() {}
+        default void f558() {}
+    }
+    static interface I13 {
+        default void f559() {}
+        default void f560() {}
+        default void f561() {}
+        default void f562() {}
+        default void f563() {}
+        default void f564() {}
+        default void f565() {}
+        default void f566() {}
+        default void f567() {}
+        default void f568() {}
+        default void f569() {}
+        default void f570() {}
+        default void f571() {}
+        default void f572() {}
+        default void f573() {}
+        default void f574() {}
+        default void f575() {}
+        default void f576() {}
+        default void f577() {}
+        default void f578() {}
+        default void f579() {}
+        default void f580() {}
+        default void f581() {}
+        default void f582() {}
+        default void f583() {}
+        default void f584() {}
+        default void f585() {}
+        default void f586() {}
+        default void f587() {}
+        default void f588() {}
+        default void f589() {}
+        default void f590() {}
+        default void f591() {}
+        default void f592() {}
+        default void f593() {}
+        default void f594() {}
+        default void f595() {}
+        default void f596() {}
+        default void f597() {}
+        default void f598() {}
+        default void f599() {}
+        default void f600() {}
+        default void f601() {}
+    }
+    static interface I14 {
+        default void f602() {}
+        default void f603() {}
+        default void f604() {}
+        default void f605() {}
+        default void f606() {}
+        default void f607() {}
+        default void f608() {}
+        default void f609() {}
+        default void f610() {}
+        default void f611() {}
+        default void f612() {}
+        default void f613() {}
+        default void f614() {}
+        default void f615() {}
+        default void f616() {}
+        default void f617() {}
+        default void f618() {}
+        default void f619() {}
+        default void f620() {}
+        default void f621() {}
+        default void f622() {}
+        default void f623() {}
+        default void f624() {}
+        default void f625() {}
+        default void f626() {}
+        default void f627() {}
+        default void f628() {}
+        default void f629() {}
+        default void f630() {}
+        default void f631() {}
+        default void f632() {}
+        default void f633() {}
+        default void f634() {}
+        default void f635() {}
+        default void f636() {}
+        default void f637() {}
+        default void f638() {}
+        default void f639() {}
+        default void f640() {}
+        default void f641() {}
+        default void f642() {}
+        default void f643() {}
+        default void f644() {}
+    }
+    static interface I15 {
+        default void f645() {}
+        default void f646() {}
+        default void f647() {}
+        default void f648() {}
+        default void f649() {}
+        default void f650() {}
+        default void f651() {}
+        default void f652() {}
+        default void f653() {}
+        default void f654() {}
+        default void f655() {}
+        default void f656() {}
+        default void f657() {}
+        default void f658() {}
+        default void f659() {}
+        default void f660() {}
+        default void f661() {}
+        default void f662() {}
+        default void f663() {}
+        default void f664() {}
+        default void f665() {}
+        default void f666() {}
+        default void f667() {}
+        default void f668() {}
+        default void f669() {}
+        default void f670() {}
+        default void f671() {}
+        default void f672() {}
+        default void f673() {}
+        default void f674() {}
+        default void f675() {}
+        default void f676() {}
+        default void f677() {}
+        default void f678() {}
+        default void f679() {}
+        default void f680() {}
+        default void f681() {}
+        default void f682() {}
+        default void f683() {}
+        default void f684() {}
+        default void f685() {}
+        default void f686() {}
+        default void f687() {}
+    }
+    static interface I16 {
+        default void f688() {}
+        default void f689() {}
+        default void f690() {}
+        default void f691() {}
+        default void f692() {}
+        default void f693() {}
+        default void f694() {}
+        default void f695() {}
+        default void f696() {}
+        default void f697() {}
+        default void f698() {}
+        default void f699() {}
+        default void f700() {}
+        default void f701() {}
+        default void f702() {}
+        default void f703() {}
+        default void f704() {}
+        default void f705() {}
+        default void f706() {}
+        default void f707() {}
+        default void f708() {}
+        default void f709() {}
+        default void f710() {}
+        default void f711() {}
+        default void f712() {}
+        default void f713() {}
+        default void f714() {}
+        default void f715() {}
+        default void f716() {}
+        default void f717() {}
+        default void f718() {}
+        default void f719() {}
+        default void f720() {}
+        default void f721() {}
+        default void f722() {}
+        default void f723() {}
+        default void f724() {}
+        default void f725() {}
+        default void f726() {}
+        default void f727() {}
+        default void f728() {}
+        default void f729() {}
+        default void f730() {}
+    }
+    static interface I17 {
+        default void f731() {}
+        default void f732() {}
+        default void f733() {}
+        default void f734() {}
+        default void f735() {}
+        default void f736() {}
+        default void f737() {}
+        default void f738() {}
+        default void f739() {}
+        default void f740() {}
+        default void f741() {}
+        default void f742() {}
+        default void f743() {}
+        default void f744() {}
+        default void f745() {}
+        default void f746() {}
+        default void f747() {}
+        default void f748() {}
+        default void f749() {}
+        default void f750() {}
+        default void f751() {}
+        default void f752() {}
+        default void f753() {}
+        default void f754() {}
+        default void f755() {}
+        default void f756() {}
+        default void f757() {}
+        default void f758() {}
+        default void f759() {}
+        default void f760() {}
+        default void f761() {}
+        default void f762() {}
+        default void f763() {}
+        default void f764() {}
+        default void f765() {}
+        default void f766() {}
+        default void f767() {}
+        default void f768() {}
+        default void f769() {}
+        default void f770() {}
+        default void f771() {}
+        default void f772() {}
+        default void f773() {}
+    }
+    static interface I18 {
+        default void f774() {}
+        default void f775() {}
+        default void f776() {}
+        default void f777() {}
+        default void f778() {}
+        default void f779() {}
+        default void f780() {}
+        default void f781() {}
+        default void f782() {}
+        default void f783() {}
+        default void f784() {}
+        default void f785() {}
+        default void f786() {}
+        default void f787() {}
+        default void f788() {}
+        default void f789() {}
+        default void f790() {}
+        default void f791() {}
+        default void f792() {}
+        default void f793() {}
+        default void f794() {}
+        default void f795() {}
+        default void f796() {}
+        default void f797() {}
+        default void f798() {}
+        default void f799() {}
+        default void f800() {}
+        default void f801() {}
+        default void f802() {}
+        default void f803() {}
+        default void f804() {}
+        default void f805() {}
+        default void f806() {}
+        default void f807() {}
+        default void f808() {}
+        default void f809() {}
+        default void f810() {}
+        default void f811() {}
+        default void f812() {}
+        default void f813() {}
+        default void f814() {}
+        default void f815() {}
+        default void f816() {}
+    }
+    static interface I19 {
+        default void f817() {}
+        default void f818() {}
+        default void f819() {}
+        default void f820() {}
+        default void f821() {}
+        default void f822() {}
+        default void f823() {}
+        default void f824() {}
+        default void f825() {}
+        default void f826() {}
+        default void f827() {}
+        default void f828() {}
+        default void f829() {}
+        default void f830() {}
+        default void f831() {}
+        default void f832() {}
+        default void f833() {}
+        default void f834() {}
+        default void f835() {}
+        default void f836() {}
+        default void f837() {}
+        default void f838() {}
+        default void f839() {}
+        default void f840() {}
+        default void f841() {}
+        default void f842() {}
+        default void f843() {}
+        default void f844() {}
+        default void f845() {}
+        default void f846() {}
+        default void f847() {}
+        default void f848() {}
+        default void f849() {}
+        default void f850() {}
+        default void f851() {}
+        default void f852() {}
+        default void f853() {}
+        default void f854() {}
+        default void f855() {}
+        default void f856() {}
+        default void f857() {}
+        default void f858() {}
+        default void f859() {}
+    }
+}
diff --git a/benchmarks/src/benchmarks/ImtConflictBenchmarkGen.py b/benchmarks/src/benchmarks/ImtConflictBenchmarkGen.py
new file mode 100644
index 0000000..8f1fd7e
--- /dev/null
+++ b/benchmarks/src/benchmarks/ImtConflictBenchmarkGen.py
@@ -0,0 +1,102 @@
+#
+# Copyright 2016 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.
+#
+
+import sys
+
+max_conflict_depth = 20 # In practice does not go above 20 for reasonable IMT sizes
+try:
+    imt_size = int(sys.argv[1])
+except (IndexError, ValueError):
+    print("Usage: python ImtConflictBenchmarkGen.py <IMT_SIZE>")
+    sys.exit(1)
+
+license = """\
+/*
+ * Copyright 2016 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.
+ */
+"""
+description = """
+/**
+ * This file is script-generated by ImtConflictBenchmarkGen.py.
+ * It measures the performance impact of conflicts in interface method tables.
+ * Run `python ImtConflictBenchmarkGen.py > ImtConflictBenchmark.java` to regenerate.
+ *
+ * Each interface has 64 methods, which is the current size of an IMT. C0 implements
+ * one interface, C1 implements two, C2 implements three, and so on. The intent
+ * is that C0 has no conflicts in its IMT, C1 has depth-2 conflicts in
+ * its IMT, C2 has depth-3 conflicts, etc. This is currently guaranteed by
+ * the fact that we hash interface methods by taking their method index modulo 64.
+ * (Note that a "conflict depth" of 1 means no conflict at all.)
+ */\
+"""
+
+print(license)
+print("package benchmarks;")
+print("import com.google.caliper.BeforeExperiment;")
+print(description)
+
+print("public class ImtConflictBenchmark {")
+
+# Warm up interface method tables
+print("    @BeforeExperiment")
+print("    public void setup() {")
+for i in xrange(max_conflict_depth):
+    print("        C{0} c{0} = new C{0}();".format(i))
+    for j in xrange(i+1):
+        print("        callF{}(c{});".format(imt_size * j, i))
+print("    }")
+
+# Print test cases--one for each conflict depth
+for i in xrange(max_conflict_depth):
+    print("    public void timeConflictDepth{:02d}(int nreps) {{".format(i+1))
+    print("        C{0} c{0} = new C{0}();".format(i))
+    print("        for (int i = 0; i < nreps; i++) {")
+    # Cycle through each interface method in an IMT entry in order
+    # to test all conflict resolution possibilities
+    for j in xrange(max_conflict_depth):
+        print("            callF{}(c{});".format(imt_size * (j % (i + 1)), i))
+    print("        }")
+    print("    }")
+
+# Make calls through the IMTs
+for i in xrange(max_conflict_depth):
+    print("    public void callF{0}(I{1} i) {{ i.f{0}(); }}".format(imt_size*i, i))
+
+# Class definitions, implementing varying amounts of interfaces
+for i in xrange(max_conflict_depth):
+    interfaces = ", ".join(["I{}".format(j) for j in xrange(i+1)])
+    print("    static class C{} implements {} {{}}".format(i, interfaces))
+
+# Interface definitions, each with enough methods to fill an entire IMT
+for i in xrange(max_conflict_depth):
+    print("    static interface I{} {{".format(i))
+    for j in xrange(imt_size):
+        print("        default void f{}() {{}}".format(i*imt_size + j))
+    print("    }")
+
+print "}"
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ClassTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ClassTest.java
index 95dad9a..170c901 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ClassTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/ClassTest.java
@@ -565,6 +565,26 @@
                 "class [Ljava.lang.Object;", clazz.toString());
     }
 
+    /**
+     * java.lang.Class#getTypeName()
+     */
+    public void test_getTypeName() throws ClassNotFoundException {
+        assertEquals("Class toString printed wrong value",
+                "int", int.class.getTypeName());
+
+        Class<?> clazz = null;
+        clazz = Class.forName("[I");
+        assertEquals("Class toString printed wrong value",
+                "int[]", clazz.getTypeName());
+
+        clazz = Class.forName("java.lang.Object");
+        assertEquals("Class toString printed wrong value",
+                "java.lang.Object", clazz.getTypeName());
+
+        clazz = Class.forName("[Ljava.lang.Object;");
+        assertEquals("Class toString printed wrong value",
+                "java.lang.Object[]", clazz.getTypeName());
+    }
 
     // Regression Test for JIRA-2047
     public void test_getResourceAsStream_withSharpChar() throws Exception {
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericArrayTypeTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericArrayTypeTest.java
index 4888fd2..58b15e0 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericArrayTypeTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/GenericArrayTypeTest.java
@@ -36,6 +36,9 @@
         Field field = clazz.getDeclaredField("array");
         Type genericType = field.getGenericType();
         assertInstanceOf(GenericArrayType.class, genericType);
+        assertEquals("T[]", genericType.toString());
+        assertEquals("T[]", genericType.getTypeName());
+
         Type componentType = ((GenericArrayType) genericType).getGenericComponentType();
         assertEquals(getTypeParameter(clazz), componentType);
         assertInstanceOf(TypeVariable.class, componentType);
@@ -52,13 +55,17 @@
         Class<? extends B> clazz = GenericArrayTypeTest.B.class;
         Field field = clazz.getDeclaredField("array");
         Type genericType = field.getGenericType();
-
         assertInstanceOf(GenericArrayType.class, genericType);
+
+        String bName = B.class.getName();
+        assertEquals(bName + "<T>[]", genericType.toString());
+        assertEquals(bName + "<T>[]", genericType.getTypeName());
+
         GenericArrayType arrayType = (GenericArrayType) genericType;
         Type componentType = arrayType.getGenericComponentType();
         assertInstanceOf(ParameterizedType.class, componentType);
-        ParameterizedType parameteriezdType = (ParameterizedType) componentType;
-        assertEquals(clazz, parameteriezdType.getRawType());
-        assertEquals(clazz.getTypeParameters()[0], parameteriezdType.getActualTypeArguments()[0]);
+        ParameterizedType parameterizedType = (ParameterizedType) componentType;
+        assertEquals(clazz, parameterizedType.getRawType());
+        assertEquals(clazz.getTypeParameters()[0], parameterizedType.getActualTypeArguments()[0]);
     }
 }
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/ParameterizedTypeTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/ParameterizedTypeTest.java
index 3b2614e..6004863 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/ParameterizedTypeTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/ParameterizedTypeTest.java
@@ -32,6 +32,11 @@
         Class<? extends B> clazz = B.class;
         Type genericSuperclass = clazz.getGenericSuperclass();
         assertInstanceOf(ParameterizedType.class, genericSuperclass);
+
+        String aName = A.class.getName();
+        assertEquals(aName + "<java.lang.String>", genericSuperclass.toString());
+        assertEquals(aName + "<java.lang.String>", genericSuperclass.getTypeName());
+
         ParameterizedType parameterizedType = (ParameterizedType) genericSuperclass;
         assertEquals(ParameterizedTypeTest.class, parameterizedType.getOwnerType());
         assertEquals(A.class, parameterizedType.getRawType());
@@ -48,6 +53,11 @@
         Class<? extends D> clazz = D.class;
         Type genericSuperclass = clazz.getGenericSuperclass();
         assertInstanceOf(ParameterizedType.class, genericSuperclass);
+
+        String cName = C.class.getName();
+        assertEquals(cName + "<T>", genericSuperclass.toString());
+        assertEquals(cName + "<T>", genericSuperclass.getTypeName());
+
         ParameterizedType parameterizedType = (ParameterizedType) genericSuperclass;
         assertEquals(ParameterizedTypeTest.class, parameterizedType.getOwnerType());
         assertEquals(C.class, parameterizedType.getRawType());
@@ -70,6 +80,10 @@
         assertEquals(ParameterizedTypeTest.class, parameterizedType.getOwnerType());
         assertEquals(E.class, parameterizedType.getRawType());
 
+        String eName = E.class.getName();
+        assertEquals(eName + "<T>", parameterizedType.toString());
+        assertEquals(eName + "<T>", parameterizedType.getTypeName());
+
         Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
         assertLenghtOne(actualTypeArguments);
         assertEquals(getTypeParameter(clazz), actualTypeArguments[0]);
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/TypeVariableTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/TypeVariableTest.java
index d1c7ea9..8f93da4 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/TypeVariableTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/TypeVariableTest.java
@@ -35,6 +35,8 @@
         TypeVariable<Class> typeVariable = typeParameters[0];
         assertEquals(clazz, typeVariable.getGenericDeclaration());
         assertEquals("T", typeVariable.getName());
+        assertEquals("T", typeVariable.toString());
+        assertEquals("T", typeVariable.getTypeName());
         Type[] bounds = typeVariable.getBounds();
         assertLenghtOne(bounds);
         assertEquals(Object.class, bounds[0]);
@@ -51,6 +53,8 @@
         TypeVariable<Method> typeVariable = typeParameters[0];
         assertEquals(method, typeVariable.getGenericDeclaration());
         assertEquals("T", typeVariable.getName());
+        assertEquals("T", typeVariable.toString());
+        assertEquals("T", typeVariable.getTypeName());
         Type[] bounds = typeVariable.getBounds();
         assertLenghtOne(bounds);
         assertEquals(Object.class, bounds[0]);
@@ -67,6 +71,8 @@
         TypeVariable<?> typeVariable = typeParameters[0];
         assertEquals(constructor, typeVariable.getGenericDeclaration());
         assertEquals("T", typeVariable.getName());
+        assertEquals("T", typeVariable.toString());
+        assertEquals("T", typeVariable.getTypeName());
         Type[] bounds = typeVariable.getBounds();
         assertLenghtOne(bounds);
         assertEquals(Object.class, bounds[0]);
@@ -79,13 +85,18 @@
         assertEquals(3, typeParameters.length);
         assertEquals("Q", typeParameters[0].getName());
         assertEquals(clazz, typeParameters[0].getGenericDeclaration());
+        assertEquals("Q", typeParameters[0].toString());
+        assertEquals("Q", typeParameters[0].getTypeName());
 
         assertEquals("R", typeParameters[1].getName());
         assertEquals(clazz, typeParameters[1].getGenericDeclaration());
+        assertEquals("R", typeParameters[1].toString());
+        assertEquals("R", typeParameters[1].getTypeName());
 
         assertEquals("S", typeParameters[2].getName());
         assertEquals(clazz, typeParameters[2].getGenericDeclaration());
-
+        assertEquals("S", typeParameters[2].toString());
+        assertEquals("S", typeParameters[2].getTypeName());
     }
 
     static class E {
@@ -99,12 +110,18 @@
         assertEquals(3, typeParameters.length);
         assertEquals("Q", typeParameters[0].getName());
         assertEquals(method, typeParameters[0].getGenericDeclaration());
+        assertEquals("Q", typeParameters[0].toString());
+        assertEquals("Q", typeParameters[0].getTypeName());
 
         assertEquals("R", typeParameters[1].getName());
         assertEquals(method, typeParameters[1].getGenericDeclaration());
+        assertEquals("R", typeParameters[1].toString());
+        assertEquals("R", typeParameters[1].getTypeName());
 
         assertEquals("S", typeParameters[2].getName());
         assertEquals(method, typeParameters[2].getGenericDeclaration());
+        assertEquals("S", typeParameters[2].toString());
+        assertEquals("S", typeParameters[2].getTypeName());
     }
 
     static class F {
@@ -118,12 +135,18 @@
         assertEquals(3, typeParameters.length);
         assertEquals("Q", typeParameters[0].getName());
         assertEquals(constructor, typeParameters[0].getGenericDeclaration());
+        assertEquals("Q", typeParameters[0].toString());
+        assertEquals("Q", typeParameters[0].getTypeName());
 
         assertEquals("R", typeParameters[1].getName());
         assertEquals(constructor, typeParameters[1].getGenericDeclaration());
+        assertEquals("R", typeParameters[1].toString());
+        assertEquals("R", typeParameters[1].getTypeName());
 
         assertEquals("S", typeParameters[2].getName());
         assertEquals(constructor, typeParameters[2].getGenericDeclaration());
+        assertEquals("S", typeParameters[2].toString());
+        assertEquals("S", typeParameters[2].getTypeName());
     }
 
     static class G <T extends Number>{}
@@ -135,6 +158,8 @@
         Type[] bounds = typeVariable.getBounds();
         assertLenghtOne(bounds);
         assertEquals(Number.class, bounds[0]);
+        assertEquals("T", typeVariable.toString());
+        assertEquals("T", typeVariable.getTypeName());
     }
 
     static class H <T extends Number & Serializable >{}
@@ -146,5 +171,7 @@
         assertEquals(2, bounds.length);
         assertEquals(Number.class, bounds[0]);
         assertEquals(Serializable.class, bounds[1]);
+        assertEquals("T", typeVariable.toString());
+        assertEquals("T", typeVariable.getTypeName());
     }
 }
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/WildcardTypeTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/WildcardTypeTest.java
index e29fd47..9d3a8b0 100644
--- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/WildcardTypeTest.java
+++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/reflect/WildcardTypeTest.java
@@ -76,6 +76,8 @@
         assertInstanceOf(WildcardType.class, actualTypeArguments[0]);
 
         WildcardType wildcardType = (WildcardType) actualTypeArguments[0];
+        assertEquals("? super T", wildcardType.toString());
+        assertEquals("? super T", wildcardType.getTypeName());
 
         Type[] lowerBounds = wildcardType.getLowerBounds();
         assertLenghtOne(lowerBounds);
@@ -97,6 +99,8 @@
         assertInstanceOf(WildcardType.class, actualTypeArguments[0]);
 
         WildcardType wildcardType = (WildcardType) actualTypeArguments[0];
+        assertEquals("? extends T", wildcardType.toString());
+        assertEquals("? extends T", wildcardType.getTypeName());
         assertLenghtZero(wildcardType.getLowerBounds());
 
         Type[] upperBounds = wildcardType.getUpperBounds();
diff --git a/libart/src/main/java/java/lang/reflect/AbstractMethod.java b/libart/src/main/java/java/lang/reflect/AbstractMethod.java
index 0126765..cd2666f 100644
--- a/libart/src/main/java/java/lang/reflect/AbstractMethod.java
+++ b/libart/src/main/java/java/lang/reflect/AbstractMethod.java
@@ -33,8 +33,8 @@
 package java.lang.reflect;
 
 import com.android.dex.Dex;
+
 import java.lang.annotation.Annotation;
-import java.util.List;
 import libcore.reflect.GenericSignatureParser;
 import libcore.reflect.ListOfTypes;
 import libcore.reflect.Types;
@@ -44,27 +44,33 @@
  * This class represents an abstract method. Abstract methods are either methods or constructors.
  * @hide
  */
-public abstract class AbstractMethod extends AccessibleObject {
+public abstract class AbstractMethod extends Executable {
     /** Bits encoding access (e.g. public, private) as well as other runtime specific flags */
-    protected int accessFlags;
+    @SuppressWarnings("unused") // set by runtime
+    private int accessFlags;
 
     /**
-     * The ArtMethod associated with this Method, requried for dispatching due to entrypoints
+     * The ArtMethod associated with this Method, required for dispatching due to entrypoints
      * Classloader is held live by the declaring class.
      * Hidden to workaround b/16828157.
      * @hide
      */
-    protected long artMethod;
+    @SuppressWarnings("unused") // set by runtime
+    private long artMethod;
 
     /** Method's declaring class */
-    protected Class<?> declaringClass;
+    @SuppressWarnings("unused") // set by runtime
+    private Class<?> declaringClass;
 
     /** Overriden method's declaring class (same as declaringClass unless declaringClass
-     * is a proxy class) */
-    protected Class<?> declaringClassOfOverriddenMethod;
+     * is a proxy class)
+     */
+    @SuppressWarnings("unused") // set by runtime
+    private Class<?> declaringClassOfOverriddenMethod;
 
     /** The method index of this method within its defining dex file */
-    protected int dexMethodIndex;
+    @SuppressWarnings("unused") // set by runtime
+    private int dexMethodIndex;
 
     /**
      * Hidden to workaround b/16828157.
@@ -73,10 +79,6 @@
     protected AbstractMethod() {
     }
 
-    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
-        return super.getAnnotation(annotationClass);
-    }
-
     /**
      * We insert native method stubs for abstract methods so we don't have to
      * check the access flags at the time of the method call.  This results in
@@ -99,65 +101,38 @@
         return flags & 0xffff;  // mask out bits not used by Java
     }
 
-    int getModifiers() {
+    // Overrides {@link Executable#getModifiers()} - for ART behavior see fixMethodFlags().
+    @Override
+    public int getModifiers() {
         return fixMethodFlags(accessFlags);
     }
 
-    boolean isVarArgs() {
-        return (accessFlags & Modifier.VARARGS) != 0;
-    }
-
-    boolean isBridge() {
-        return (accessFlags & Modifier.BRIDGE) != 0;
-    }
-
-    boolean isSynthetic() {
+    // Overrides {@link Executable#isSynthetic()} - we can do it cheaply here.
+    @Override
+    public boolean isSynthetic() {
         return (accessFlags & Modifier.SYNTHETIC) != 0;
     }
 
-    boolean isDefault() {
-      return (accessFlags & Modifier.DEFAULT) != 0;
+    // Overrides {@link Executable#isVarArgs()} - we can do it cheaply here.
+    @Override
+    public boolean isVarArgs() {
+        return (accessFlags & Modifier.VARARGS) != 0;
     }
 
-    /**
-     * @hide
-     */
-    public final int getAccessFlags() {
-        return accessFlags;
-    }
-
-    /**
-     * Returns the class that declares this constructor or method.
-     */
-    Class<?> getDeclaringClass() {
+    @Override
+    public Class<?> getDeclaringClass() {
         return declaringClass;
     }
 
     /**
-     * Returns the index of this method's ID in its dex file.
-     *
-     * @hide
-     */
-    public final int getDexMethodIndex() {
-        return dexMethodIndex;
-    }
-
-    /**
-     * Returns the name of the method or constructor represented by this
-     * instance.
-     *
-     * @return the name of this method
-     */
-    abstract public String getName();
-
-    /**
      * Returns an array of {@code Class} objects associated with the parameter types of this
      * abstract method. If the method was declared with no parameters, an
      * empty array will be returned.
      *
      * @return the parameter types
      */
-    Class<?>[] getParameterTypes() {
+    @Override
+    public Class<?>[] getParameterTypes() {
         Dex dex = declaringClassOfOverriddenMethod.getDex();
         short[] types = dex.parameterTypeIndicesFromMethodIndex(dexMethodIndex);
         if (types.length == 0) {
@@ -171,30 +146,23 @@
         return parametersArray;
     }
 
-    /**
-     * Returns true if {@code other} has the same declaring class, name,
-     * parameters and return type as this method.
-     */
-    @Override public boolean equals(Object other) {
-        if (!(other instanceof AbstractMethod)) {
-            return false;
-        }
-        // Exactly one instance of each member in this runtime, todo, does this work for proxies?
-        AbstractMethod otherMethod = (AbstractMethod) other;
-        return this.declaringClass == otherMethod.declaringClass &&
-            this.dexMethodIndex == otherMethod.dexMethodIndex;
+    @Override
+    public int getParameterCount() {
+        Dex dex = declaringClassOfOverriddenMethod.getDex();
+        short[] types = dex.parameterTypeIndicesFromMethodIndex(dexMethodIndex);
+        return types.length;
     }
 
-    String toGenericString() {
-        return toGenericStringHelper();
+    @Override
+    public Type[] getGenericParameterTypes() {
+        return Types.getTypeArray(
+                getMethodOrConstructorGenericInfoInternal().genericParameterTypes, false);
     }
 
-    Type[] getGenericParameterTypes() {
-        return Types.getTypeArray(getMethodOrConstructorGenericInfo().genericParameterTypes, false);
-    }
-
-    Type[] getGenericExceptionTypes() {
-        return Types.getTypeArray(getMethodOrConstructorGenericInfo().genericExceptionTypes, false);
+    @Override
+    public Type[] getGenericExceptionTypes() {
+        return Types.getTypeArray(
+                getMethodOrConstructorGenericInfoInternal().genericExceptionTypes, false);
     }
 
     @Override public native Annotation[] getDeclaredAnnotations();
@@ -205,22 +173,33 @@
         }
         return isAnnotationPresentNative(annotationType);
     }
-
     private native boolean isAnnotationPresentNative(Class<? extends Annotation> annotationType);
 
-    public Annotation[] getAnnotations() {
-        return super.getAnnotations();
+    @Override
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        if (annotationClass == null) {
+            throw new NullPointerException("annotationClass == null");
+        }
+        return getAnnotationNative(annotationClass);
     }
+    private native <T extends Annotation> T getAnnotationNative(Class<T> annotationClass);
+
+    @Override
+    public Annotation[][] getParameterAnnotations() {
+        Annotation[][] parameterAnnotations = getParameterAnnotationsNative();
+        if (parameterAnnotations == null) {
+            parameterAnnotations = new Annotation[getParameterTypes().length][0];
+        }
+        return parameterAnnotations;
+    }
+    private native Annotation[][] getParameterAnnotationsNative();
 
     /**
-     * Returns an array of arrays that represent the annotations of the formal
-     * parameters of this method. If there are no parameters on this method,
-     * then an empty array is returned. If there are no annotations set, then
-     * and array of empty arrays is returned.
-     *
-     * @return an array of arrays of {@code Annotation} instances
+     * @hide
      */
-    public abstract Annotation[][] getParameterAnnotations();
+    public final int getAccessFlags() {
+        return accessFlags;
+    }
 
     /**
      * Returns the constructor's signature in non-printable form. This is called
@@ -250,28 +229,15 @@
     /**
      * Returns generic information associated with this method/constructor member.
      */
-    final GenericInfo getMethodOrConstructorGenericInfo() {
+    final GenericInfo getMethodOrConstructorGenericInfoInternal() {
         String signatureAttribute = getSignatureAttribute();
-        Member member;
-        Class<?>[] exceptionTypes;
-        boolean method = this instanceof Method;
-        if (method) {
-            Method m = (Method) this;
-            member = m;
-            exceptionTypes = m.getExceptionTypes();
-        } else {
-            Constructor<?> c = (Constructor<?>) this;
-            member = c;
-            exceptionTypes = c.getExceptionTypes();
-        }
+        Class<?>[] exceptionTypes = this.getExceptionTypes();
         GenericSignatureParser parser =
-            new GenericSignatureParser(member.getDeclaringClass().getClassLoader());
-        if (method) {
-            parser.parseForMethod((GenericDeclaration) this, signatureAttribute, exceptionTypes);
+            new GenericSignatureParser(this.getDeclaringClass().getClassLoader());
+        if (this instanceof Method) {
+            parser.parseForMethod(this, signatureAttribute, exceptionTypes);
         } else {
-            parser.parseForConstructor((GenericDeclaration) this,
-                                       signatureAttribute,
-                                       exceptionTypes);
+            parser.parseForConstructor(this, signatureAttribute, exceptionTypes);
         }
         return new GenericInfo(parser.exceptionTypes, parser.parameterTypes,
                                parser.returnType, parser.formalTypeParameters);
@@ -288,10 +254,13 @@
         }
         return result.toString();
     }
-
     private native String[] getSignatureAnnotation();
 
-    protected boolean equalMethodParameters(Class<?>[] params) {
+    final boolean equalNameAndParametersInternal(Method m) {
+        return getName().equals(m.getName()) && equalMethodParameters(m.getParameterTypes());
+    }
+
+    private boolean equalMethodParameters(Class<?>[] params) {
         Dex dex = declaringClassOfOverriddenMethod.getDex();
         short[] types = dex.parameterTypeIndicesFromMethodIndex(dexMethodIndex);
         if (types.length != params.length) {
@@ -305,7 +274,7 @@
         return true;
     }
 
-    protected int compareParameters(Class<?>[] params) {
+    final int compareMethodParametersInternal(Class<?>[] params) {
         Dex dex = declaringClassOfOverriddenMethod.getDex();
         short[] types = dex.parameterTypeIndicesFromMethodIndex(dexMethodIndex);
         int length = Math.min(types.length, params.length);
@@ -322,51 +291,26 @@
         return types.length - params.length;
     }
 
-    /**
-     * Helper for Method and Constructor for toGenericString
-     */
-    final String toGenericStringHelper() {
-        StringBuilder sb = new StringBuilder(80);
-        GenericInfo info =  getMethodOrConstructorGenericInfo();
-        int modifiers = ((Member)this).getModifiers();
-        // append modifiers if any
-        if (modifiers != 0) {
-            sb.append(Modifier.toString(modifiers & ~Modifier.VARARGS)).append(' ');
-        }
-        // append type parameters
-        if (info.formalTypeParameters != null && info.formalTypeParameters.length > 0) {
-            sb.append('<');
-            for (int i = 0; i < info.formalTypeParameters.length; i++) {
-                Types.appendGenericType(sb, info.formalTypeParameters[i]);
-                if (i < info.formalTypeParameters.length - 1) {
-                    sb.append(",");
-                }
-            }
-            sb.append("> ");
-        }
-        Class<?> declaringClass = ((Member) this).getDeclaringClass();
-        if (this instanceof Constructor) {
-            // append constructor name
-            Types.appendTypeName(sb, declaringClass);
-        } else {
-            // append return type
-            Types.appendGenericType(sb, Types.getType(info.genericReturnType));
-            sb.append(' ');
-            // append method name
-            Types.appendTypeName(sb, declaringClass);
-            sb.append(".").append(((Method) this).getName());
-        }
-        // append parameters
-        sb.append('(');
-        Types.appendArrayGenericType(sb, info.genericParameterTypes.getResolvedTypes());
-        sb.append(')');
-        // append exceptions if any
-        Type[] genericExceptionTypeArray =
-            Types.getTypeArray(info.genericExceptionTypes, false);
-        if (genericExceptionTypeArray.length > 0) {
-            sb.append(" throws ");
-            Types.appendArrayGenericType(sb, genericExceptionTypeArray);
-        }
-        return sb.toString();
+    final String getMethodNameInternal() {
+        Dex dex = declaringClassOfOverriddenMethod.getDex();
+        int nameIndex = dex.nameIndexFromMethodIndex(dexMethodIndex);
+        return declaringClassOfOverriddenMethod.getDexCacheString(dex, nameIndex);
+    }
+
+    final Class<?> getMethodReturnTypeInternal() {
+        Dex dex = declaringClassOfOverriddenMethod.getDex();
+        int returnTypeIndex = dex.returnTypeIndexFromMethodIndex(dexMethodIndex);
+        // Note, in the case of a Proxy the dex cache types are equal.
+        return declaringClassOfOverriddenMethod.getDexCacheType(dex, returnTypeIndex);
+    }
+
+    /** A cheap implementation for {@link Method#isDefault()}. */
+    final boolean isDefaultMethodInternal() {
+        return (accessFlags & Modifier.DEFAULT) != 0;
+    }
+
+    /** A cheap implementation for {@link Method#isBridge()}. */
+    final boolean isBridgeMethodInternal() {
+        return (accessFlags & Modifier.BRIDGE) != 0;
     }
 }
diff --git a/luni/src/main/java/libcore/reflect/AnnotatedElements.java b/luni/src/main/java/libcore/reflect/AnnotatedElements.java
index 2fe2d2b..2b4fb5e 100644
--- a/luni/src/main/java/libcore/reflect/AnnotatedElements.java
+++ b/luni/src/main/java/libcore/reflect/AnnotatedElements.java
@@ -32,45 +32,15 @@
  */
 public final class AnnotatedElements {
   /**
-   * Default implementation for {@link AnnotatedElement#getDeclaredAnnotation}.
-   *
-   * @return Directly present annotation of type {@code annotationClass} for {@code element},
-   *         or {@code null} if none was found.
-   */
-  public static <T extends Annotation> T getDeclaredAnnotation(AnnotatedElement element,
-      Class<T> annotationClass) {
-    if (annotationClass == null) {
-      throw new NullPointerException("annotationClass");
-    }
-
-    Annotation[] annotations = element.getDeclaredAnnotations();
-
-    // Safeguard: getDeclaredAnnotations should never return null.
-    if (annotations == null) {
-      return null;
-    }
-
-    // The annotation might be directly present:
-    // Return the first (and only) annotation whose class matches annotationClass.
-    for (int i = 0; i < annotations.length; ++i) {
-      if (annotationClass.isInstance(annotations[i])) {
-        return (T)annotations[i];  // Safe because of above guard.
-      }
-    }
-
-    // The annotation was *not* directly present:
-    // If the array was empty, or we found no matches, return null.
-    return null;
-  }
-
-  /**
-   * Default implementation for {@link AnnotatedElement#getDeclaredAnnotationsByType}.
+   * Default implementation of {@link AnnotatedElement#getDeclaredAnnotationsByType}, and
+   * {@link AnnotatedElement#getAnnotationsByType} for elements that do not support annotation
+   * inheritance.
    *
    * @return Directly/indirectly present list of annotations of type {@code annotationClass} for
    *         {@code element}, or an empty array if none were found.
    */
-  public static <T extends Annotation> T[] getDeclaredAnnotationsByType(AnnotatedElement element,
-      Class<T> annotationClass) {
+  public static <T extends Annotation> T[] getDirectOrIndirectAnnotationsByType(
+        AnnotatedElement element, Class<T> annotationClass) {
     if (annotationClass == null) {
       throw new NullPointerException("annotationClass");
     }
@@ -182,37 +152,7 @@
     return (repeatableAnnotation == null) ? null : repeatableAnnotation.value();
   }
 
-  /**
-   * Default implementation of {@link AnnotatedElement#getAnnotationsByType}.
-   *
-   * <p>
-   * This method does not handle inherited annotations and is
-   * intended for use for {@code Method}, {@code Field}, {@code Package}.
-   * The {@link Class#getAnnotationsByType} is implemented explicitly.
-   * </p>
-   *
-   * @return Associated annotations of type {@code annotationClass} for {@code element}.
-   */
-  public static <T extends Annotation> T[] getAnnotationsByType(AnnotatedElement element,
-      Class<T> annotationClass) {
-    if (annotationClass == null) {
-      throw new NullPointerException("annotationClass");
-    }
-
-    // Find any associated annotations [directly or repeatably (indirectly) present on this class].
-    T[] annotations = element.getDeclaredAnnotationsByType(annotationClass);
-    if (annotations == null) {
-      throw new AssertionError("annotations must not be null");  // Internal error.
-    }
-
-    // If nothing was found, we would look for associated annotations recursively up to the root
-    // class. However this can only happen if AnnotatedElement is a Class, which is handled
-    // in the Class override of this method.
-    return annotations;
-  }
-
   private AnnotatedElements() {
-    throw new AssertionError("Instances of AnnotatedElements not allowed");
   }
 }
 
diff --git a/luni/src/test/java/libcore/java/lang/reflect/ConstructorTest.java b/luni/src/test/java/libcore/java/lang/reflect/ConstructorTest.java
index 3ae44c6..3093bbd 100644
--- a/luni/src/test/java/libcore/java/lang/reflect/ConstructorTest.java
+++ b/luni/src/test/java/libcore/java/lang/reflect/ConstructorTest.java
@@ -45,6 +45,13 @@
         assertEquals(expectedParameters[0], parameters[0]);
     }
 
+    public void test_getParameterCount() throws Exception {
+        Class[] expectedParameters = new Class[] { Object.class };
+        Constructor<?> constructor = ConstructorTestHelper.class.getConstructor(expectedParameters);
+        int count = constructor.getParameterCount();
+        assertEquals(1, count);
+    }
+
     public void testGetConstructorWithNullArgumentsArray() throws Exception {
         Constructor<?> constructor = ConstructorTestHelper.class.getConstructor((Class[]) null);
         assertEquals(0, constructor.getParameterTypes().length);
diff --git a/luni/src/test/java/libcore/java/lang/reflect/MethodTest.java b/luni/src/test/java/libcore/java/lang/reflect/MethodTest.java
index a8764c2..5cb88d6 100644
--- a/luni/src/test/java/libcore/java/lang/reflect/MethodTest.java
+++ b/luni/src/test/java/libcore/java/lang/reflect/MethodTest.java
@@ -53,6 +53,13 @@
         assertEquals(expectedParameters[0], parameters[0]);
     }
 
+    public void test_getParameterCount() throws Exception {
+        Class[] expectedParameters = new Class[] { Object.class };
+        Method method = MethodTestHelper.class.getMethod("m2", expectedParameters);
+        int count = method.getParameterCount();
+        assertEquals(1, count);
+    }
+
     public void testGetMethodWithPrivateMethodAndInterfaceMethod() throws Exception {
         assertEquals(InterfaceA.class, Sub.class.getMethod("a").getDeclaringClass());
     }
@@ -222,11 +229,9 @@
                 Collections.class, "sort", List.class, Comparator.class);
 
         // Java 8 language addition: default interface method.
-        // Commented until http://b/28666126 is complete: toString() for default methods not
-        // implemented yet.
-        // checkToString(
-        //        "public default java.util.function.Function java.util.function.Function.compose(java.util.function.Function)",
-        //        Function.class, "compose", Function.class);
+        checkToString(
+                "public default java.util.function.Function java.util.function.Function.compose(java.util.function.Function)",
+                Function.class, "compose", Function.class);
         // Java 8 language addition: static interface method.
         checkToString(
                 "public static java.util.function.Function java.util.function.Function.identity()",
@@ -262,11 +267,9 @@
 
 
         // Java 8 language addition: default interface method.
-        // Commented until http://b/28666126 is complete: toGenericString() for default methods not
-        // implemented yet.
-        // checkToGenericString(
-        //        "public default <V> java.util.function.Function<V, R> java.util.function.Function.compose(java.util.function.Function<? super V, ? extends T>)",
-        //        Function.class, "compose", Function.class);
+        checkToGenericString(
+                "public default <V> java.util.function.Function<V, R> java.util.function.Function.compose(java.util.function.Function<? super V, ? extends T>)",
+                Function.class, "compose", Function.class);
         // Java 8 language addition: static interface method.
         checkToGenericString(
                 "public static <T> java.util.function.Function<T, T> java.util.function.Function.identity()",
diff --git a/luni/src/test/java/libcore/javax/crypto/CipherTest.java b/luni/src/test/java/libcore/javax/crypto/CipherTest.java
index eb4a81b..50d02a4 100644
--- a/luni/src/test/java/libcore/javax/crypto/CipherTest.java
+++ b/luni/src/test/java/libcore/javax/crypto/CipherTest.java
@@ -2682,6 +2682,27 @@
 
     /*
      * Test vector generation:
+     * openssl rand -hex 16 | sed 's/\(..\)/(byte) 0x\1, /g'
+     */
+    private static final byte[] DES_112_KEY = new byte[] {
+            (byte) 0x6b, (byte) 0xb3, (byte) 0x85, (byte) 0x1c, (byte) 0x3d, (byte) 0x50,
+            (byte) 0xd4, (byte) 0x95, (byte) 0x39, (byte) 0x48, (byte) 0x77, (byte) 0x30,
+            (byte) 0x1a, (byte) 0xd7, (byte) 0x86, (byte) 0x57,
+    };
+
+    /*
+     * Test vector generation:
+     * openssl rand -hex 24 | sed 's/\(..\)/(byte) 0x\1, /g'
+     */
+    private static final byte[] DES_168_KEY = new byte[] {
+            (byte) 0xfe, (byte) 0xd4, (byte) 0xd7, (byte) 0xc9, (byte) 0x8a, (byte) 0x13,
+            (byte) 0x6a, (byte) 0xa8, (byte) 0x5a, (byte) 0xb8, (byte) 0x19, (byte) 0xb8,
+            (byte) 0xcf, (byte) 0x3c, (byte) 0x5f, (byte) 0xe0, (byte) 0xa2, (byte) 0xf7,
+            (byte) 0x7b, (byte) 0x65, (byte) 0x43, (byte) 0xc0, (byte) 0xc4, (byte) 0xe1,
+    };
+
+    /*
+     * Test vector generation:
      * openssl rand -hex 16
      * echo '3d4f8970b1f27537f40a39298a41555f' | sed 's/\(..\)/(byte) 0x\1, /g'
      */
@@ -2726,6 +2747,61 @@
     };
 
     /*
+     * Test vector generation:
+     * echo -n 'Testing rocks!' | recode ../x1 | sed 's/0x/(byte) 0x/g'
+     */
+    private static final byte[] DES_Plaintext1 = new byte[] {
+            (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x69, (byte) 0x6E,
+            (byte) 0x67, (byte) 0x20, (byte) 0x72, (byte) 0x6F, (byte) 0x63, (byte) 0x6B,
+            (byte) 0x73, (byte) 0x21
+    };
+
+    /*
+     * Test vector generation: take DES_Plaintext1 and PKCS #5 pad it manually (it's not hard).
+     */
+    private static final byte[] DES_Plaintext1_PKCS5_Padded = new byte[] {
+            (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x69, (byte) 0x6E,
+            (byte) 0x67, (byte) 0x20, (byte) 0x72, (byte) 0x6F, (byte) 0x63, (byte) 0x6B,
+            (byte) 0x73, (byte) 0x21, (byte) 0x02, (byte) 0x02,
+    };
+
+    /*
+     * Test vector generation:
+     * openssl rand -hex 8 | sed 's/\(..\)/(byte) 0x\1, /g'
+     */
+    private static final byte[] DES_IV1 = new byte[] {
+            (byte) 0x5c, (byte) 0x47, (byte) 0x5e, (byte) 0x57, (byte) 0x0c, (byte) 0x46,
+            (byte) 0xcb, (byte) 0x47,
+    };
+
+    /*
+     * Test vector generation:
+     * openssl enc -des-ede-cbc -K 6bb3851c3d50d495394877301ad78657 -iv 5c475e570c46cb47 -in blah
+     * | recode ../x1 | sed 's/0x/(byte) 0x/g'
+     */
+    private static final byte[]
+            DES_Plaintext1_Encrypted_With_DES_112_KEY_And_DESEDE_CBC_PKCS5PADDING_With_DES_IV1 =
+                    new byte[] {
+            (byte) 0x09, (byte) 0xA5, (byte) 0x5D, (byte) 0x94, (byte) 0x94, (byte) 0xAA,
+            (byte) 0x3F, (byte) 0xC8, (byte) 0xB7, (byte) 0x73, (byte) 0x94, (byte) 0x0E,
+            (byte) 0xFC, (byte) 0xF4, (byte) 0xA5, (byte) 0x28,
+    };
+
+
+    /*
+     * Test vector generation:
+     * openssl enc -des-ede3-cbc -K fed4d7c98a136aa85ab819b8cf3c5fe0a2f77b6543c0c4e1
+     *     -iv 5c475e570c46cb47 -in blah | recode ../x1 | sed 's/0x/(byte) 0x/g'
+     */
+    private static final byte[]
+            DES_Plaintext1_Encrypted_With_DES_168_KEY_And_DESEDE_CBC_PKCS5PADDING_With_DES_IV1 =
+                    new byte[] {
+            (byte) 0xC9, (byte) 0xF1, (byte) 0x83, (byte) 0x1F, (byte) 0x24, (byte) 0x83,
+            (byte) 0x2C, (byte) 0x7B, (byte) 0x66, (byte) 0x66, (byte) 0x99, (byte) 0x98,
+            (byte) 0x27, (byte) 0xB0, (byte) 0xED, (byte) 0x47
+    };
+
+    /*
      * Test vector creation:
      * echo -n 'Hello, world!' | recode ../x1 | sed 's/0x/(byte) 0x/g'
      */
@@ -2931,6 +3007,8 @@
 
         public final byte[] key;
 
+        public final String keyAlgorithm;
+
         public final byte[] iv;
 
         public final byte[] aad;
@@ -2941,9 +3019,10 @@
 
         public final byte[] plaintextPadded;
 
-        public CipherTestParam(String transformation, byte[] key, byte[] iv, byte[] aad,
-                byte[] plaintext, byte[] plaintextPadded, byte[] ciphertext) {
+        public CipherTestParam(String transformation, String keyAlgorithm, byte[] key, byte[] iv,
+                byte[] aad, byte[] plaintext, byte[] plaintextPadded, byte[] ciphertext) {
             this.transformation = transformation.toUpperCase(Locale.ROOT);
+            this.keyAlgorithm = keyAlgorithm;
             this.key = key;
             this.iv = iv;
             this.aad = aad;
@@ -2953,22 +3032,47 @@
         }
     }
 
+    private static List<CipherTestParam> DES_CIPHER_TEST_PARAMS = new ArrayList<CipherTestParam>();
+    static {
+        DES_CIPHER_TEST_PARAMS.add(new CipherTestParam(
+                "DESede/CBC/PKCS5Padding",
+                "DESede",
+                DES_112_KEY,
+                DES_IV1,
+                null,
+                DES_Plaintext1,
+                DES_Plaintext1_PKCS5_Padded,
+                DES_Plaintext1_Encrypted_With_DES_112_KEY_And_DESEDE_CBC_PKCS5PADDING_With_DES_IV1
+                ));
+        DES_CIPHER_TEST_PARAMS.add(new CipherTestParam(
+                "DESede/CBC/PKCS5Padding",
+                "DESede",
+                DES_168_KEY,
+                DES_IV1,
+                null,
+                DES_Plaintext1,
+                DES_Plaintext1_PKCS5_Padded,
+                DES_Plaintext1_Encrypted_With_DES_168_KEY_And_DESEDE_CBC_PKCS5PADDING_With_DES_IV1
+                ));
+    }
+
     private static List<CipherTestParam> CIPHER_TEST_PARAMS = new ArrayList<CipherTestParam>();
     static {
-        CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/ECB/PKCS5Padding", AES_128_KEY,
+        CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/ECB/PKCS5Padding", "AES", AES_128_KEY,
                 null,
                 null,
                 AES_128_ECB_PKCS5Padding_TestVector_1_Plaintext,
                 AES_128_ECB_PKCS5Padding_TestVector_1_Plaintext_Padded,
                 AES_128_ECB_PKCS5Padding_TestVector_1_Encrypted));
         // PKCS#5 is assumed to be equivalent to PKCS#7 -- same test vectors are thus used for both.
-        CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/ECB/PKCS7Padding", AES_128_KEY,
+        CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/ECB/PKCS7Padding", "AES", AES_128_KEY,
                 null,
                 null,
                 AES_128_ECB_PKCS5Padding_TestVector_1_Plaintext,
                 AES_128_ECB_PKCS5Padding_TestVector_1_Plaintext_Padded,
                 AES_128_ECB_PKCS5Padding_TestVector_1_Encrypted));
         CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/GCM/NOPADDING",
+                "AES",
                 AES_128_GCM_TestVector_1_Key,
                 AES_128_GCM_TestVector_1_IV,
                 AES_128_GCM_TestVector_1_AAD,
@@ -2976,19 +3080,19 @@
                 AES_128_GCM_TestVector_1_Plaintext,
                 AES_128_GCM_TestVector_1_Encrypted));
         if (IS_UNLIMITED) {
-            CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/CTR/NoPadding", AES_192_KEY,
+            CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/CTR/NoPadding", "AES", AES_192_KEY,
                     AES_192_CTR_NoPadding_TestVector_1_IV,
                     null,
                     AES_192_CTR_NoPadding_TestVector_1_Plaintext,
                     AES_192_CTR_NoPadding_TestVector_1_Plaintext,
                     AES_192_CTR_NoPadding_TestVector_1_Ciphertext));
-            CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/CBC/PKCS5Padding", AES_256_KEY,
+            CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/CBC/PKCS5Padding", "AES", AES_256_KEY,
                     AES_256_CBC_PKCS5Padding_TestVector_1_IV,
                     null,
                     AES_256_CBC_PKCS5Padding_TestVector_1_Plaintext,
                     AES_256_CBC_PKCS5Padding_TestVector_1_Plaintext_Padded,
                     AES_256_CBC_PKCS5Padding_TestVector_1_Ciphertext));
-            CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/CBC/PKCS7Padding", AES_256_KEY,
+            CIPHER_TEST_PARAMS.add(new CipherTestParam("AES/CBC/PKCS7Padding", "AES", AES_256_KEY,
                     AES_256_CBC_PKCS5Padding_TestVector_1_IV,
                     null,
                     AES_256_CBC_PKCS5Padding_TestVector_1_Plaintext,
@@ -3001,6 +3105,41 @@
         for (String provider : AES_PROVIDERS) {
             testCipher_Success(provider);
         }
+
+        testCipher_Success_ForAllSupportingProviders_AtLeastOneProviderRequired(
+                DES_CIPHER_TEST_PARAMS);
+    }
+
+    /**
+     * For each test vector in the list, tests that the transformation is supported by at least one
+     * provider and that all implementations of the transformation pass the Known Answer Test (KAT)
+     * as well as other functional tests.
+     */
+    private void testCipher_Success_ForAllSupportingProviders_AtLeastOneProviderRequired(
+            List<CipherTestParam> testVectors) throws Exception {
+        ByteArrayOutputStream errBuffer = new ByteArrayOutputStream();
+        PrintStream out = new PrintStream(errBuffer);
+        for (CipherTestParam testVector : testVectors) {
+            Provider[] providers = Security.getProviders("Cipher." + testVector.transformation);
+            if ((providers == null) || (providers.length == 0)) {
+                out.append("No providers offer " + testVector.transformation + "\n");
+                continue;
+            }
+            for (Provider provider : providers) {
+                try {
+                    checkCipher(testVector, provider.getName());
+                } catch (Throwable e) {
+                    out.append("Error encountered checking " + testVector.transformation
+                            + ", keySize=" + (testVector.key.length * 8) + " with provider "
+                            + provider.getName() + "\n");
+                    e.printStackTrace(out);
+                }
+            }
+        }
+        out.flush();
+        if (errBuffer.size() > 0) {
+            throw new Exception("Errors encountered:\n\n" + errBuffer.toString() + "\n\n");
+        }
     }
 
     private void testCipher_Success(String provider) throws Exception {
@@ -3024,7 +3163,7 @@
     }
 
     private void checkCipher(CipherTestParam p, String provider) throws Exception {
-        SecretKey key = new SecretKeySpec(p.key, "AES");
+        SecretKey key = new SecretKeySpec(p.key, p.keyAlgorithm);
         Cipher c = Cipher.getInstance(p.transformation, provider);
 
         AlgorithmParameterSpec spec = null;
diff --git a/luni/src/test/java/libcore/javax/crypto/MacTest.java b/luni/src/test/java/libcore/javax/crypto/MacTest.java
index 314a564..b308f02 100644
--- a/luni/src/test/java/libcore/javax/crypto/MacTest.java
+++ b/luni/src/test/java/libcore/javax/crypto/MacTest.java
@@ -59,4 +59,14 @@
             Security.removeProvider(mockProvider.getName());
         }
     }
+
+    /**
+     * Aliases used to be wrong due to a typo.
+     * http://b/31114355
+     */
+    public void testMac_correctAlias() throws Exception {
+        Provider androidOpenSSLProvider = Security.getProvider("AndroidOpenSSL");
+        assertEquals("HmacSHA224", androidOpenSSLProvider.get("Alg.Alias.Mac.1.2.840.113549.2.8"));
+        assertEquals("HmacSHA256", androidOpenSSLProvider.get("Alg.Alias.Mac.1.2.840.113549.2.9"));
+    }
 }
diff --git a/ojluni/src/main/java/java/lang/Class.java b/ojluni/src/main/java/java/lang/Class.java
index 44eadce..7573fc3 100644
--- a/ojluni/src/main/java/java/lang/Class.java
+++ b/ojluni/src/main/java/java/lang/Class.java
@@ -26,35 +26,36 @@
 
 package java.lang;
 
+import com.android.dex.Dex;
+
+import java.io.InputStream;
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.annotation.Inherited;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Array;
-import java.lang.reflect.Member;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.List;
+import java.util.Collections;
 import java.util.HashMap;
-import sun.reflect.CallerSensitive;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Annotation;
-
-import java.io.Serializable;
-import com.android.dex.Dex;
-import dalvik.system.VMStack;
-import libcore.reflect.InternalNames;
+import java.util.List;
 import libcore.reflect.GenericSignatureParser;
+import libcore.reflect.InternalNames;
 import libcore.reflect.Types;
 import libcore.util.BasicLruCache;
 import libcore.util.CollectionUtils;
 import libcore.util.EmptyArray;
-import java.util.Collections;
+
+import dalvik.system.VMStack;
+import sun.reflect.CallerSensitive;
 
 /**
  * Instances of the class {@code Class} represent classes and
@@ -1157,6 +1158,33 @@
         return simpleName;
     }
 
+
+    /**
+     * Return an informative string for the name of this type.
+     *
+     * @return an informative string for the name of this type
+     * @since 1.8
+     */
+    public String getTypeName() {
+        if (isArray()) {
+            try {
+                Class<?> cl = this;
+                int dimensions = 0;
+                while (cl.isArray()) {
+                    dimensions++;
+                    cl = cl.getComponentType();
+                }
+                StringBuilder sb = new StringBuilder();
+                sb.append(cl.getName());
+                for (int i = 0; i < dimensions; i++) {
+                    sb.append("[]");
+                }
+                return sb.toString();
+            } catch (Throwable e) { /*FALLTHRU*/ }
+        }
+        return getName();
+    }
+
     /**
      * Returns the canonical name of the underlying class as
      * defined by the Java Language Specification.  Returns null if
diff --git a/ojluni/src/main/java/java/lang/reflect/AccessibleObject.java b/ojluni/src/main/java/java/lang/reflect/AccessibleObject.java
index 1fbf178..22ecfb7 100644
--- a/ojluni/src/main/java/java/lang/reflect/AccessibleObject.java
+++ b/ojluni/src/main/java/java/lang/reflect/AccessibleObject.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,8 @@
 
 package java.lang.reflect;
 
-import java.security.AccessController;
-import sun.reflect.Reflection;
 import java.lang.annotation.Annotation;
 
-import libcore.reflect.AnnotatedElements;
-
 /**
  * The AccessibleObject class is the base class for Field, Method and
  * Constructor objects.  It provides the ability to flag a reflected
@@ -119,7 +115,8 @@
         setAccessible0(this, flag);
     }
 
-    /* Check that you aren't exposing java.lang.Class.<init>. */
+    /* Check that you aren't exposing java.lang.Class.<init> or sensitive
+       fields in java.lang.Class. */
     private static void setAccessible0(AccessibleObject obj, boolean flag)
         throws SecurityException
     {
@@ -174,6 +171,25 @@
     }
 
     /**
+     * {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.5
+     */
+    @Override
+    public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
+        return AnnotatedElement.super.isAnnotationPresent(annotationClass);
+    }
+
+   /**
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
+        throw new AssertionError("All subclasses should override this method");
+    }
+
+    /**
      * @since 1.5
      */
     public Annotation[] getAnnotations() {
@@ -181,6 +197,30 @@
     }
 
     /**
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    public <T extends Annotation> T getDeclaredAnnotation(Class<T> annotationClass) {
+        // Only annotations on classes are inherited, for all other
+        // objects getDeclaredAnnotation is the same as
+        // getAnnotation.
+        return getAnnotation(annotationClass);
+    }
+
+    /**
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    public <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
+        // Only annotations on classes are inherited, for all other
+        // objects getDeclaredAnnotationsByType is the same as
+        // getAnnotationsByType.
+        return getAnnotationsByType(annotationClass);
+    }
+
+    /**
      * @since 1.5
      */
     public Annotation[] getDeclaredAnnotations()  {
diff --git a/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java b/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java
index 9d2158c..96be4e4 100644
--- a/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java
+++ b/ojluni/src/main/java/java/lang/reflect/AnnotatedElement.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2016 The Android Open Source Project
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 package java.lang.reflect;
 
 import java.lang.annotation.Annotation;
+import java.util.Objects;
 import libcore.reflect.AnnotatedElements;
 
 /**
@@ -102,6 +103,50 @@
     Annotation[] getAnnotations();
 
     /**
+     * Returns an associated list of annotations on {@code this} element,
+     * whose class is {@code annotationClass}, or an empty array if nothing was found.
+     *
+     * @since 1.8
+     */
+    default <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
+        // This method does not handle inherited annotations and is intended for use for
+        // {@code Method}, {@code Field}, {@code Package}. The {@link Class#getAnnotationsByType}
+        // is implemented explicitly. Therefore this implementation does not fulfill the documented
+        // default implementation for {@link AnnotatedElement#getAnnotationsByType(Class)} but in an
+        // undetectable way because Class is final.
+        return AnnotatedElements.getDirectOrIndirectAnnotationsByType(this, annotationClass);
+    }
+
+    /**
+     * Returns a directly-present annotation on {@code this} element, whose class is
+     * {@code annotationClass}, or {@code null} if nothing was found.
+     *
+     * @since 1.8
+     */
+    default <T extends Annotation> Annotation getDeclaredAnnotation(Class<T> annotationClass) {
+        Objects.requireNonNull(annotationClass);
+        // Loop over all directly-present annotations looking for a matching one
+        for (Annotation annotation : getDeclaredAnnotations()) {
+            if (annotationClass.equals(annotation.annotationType())) {
+                // More robust to do a dynamic cast at runtime instead
+                // of compile-time only.
+                return annotationClass.cast(annotation);
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Returns a directly or indirectly present list of annotations on {@code this} element,
+     * whose class is {@code annotationClass}, or an empty array if nothing was found.
+     *
+     * @since 1.8
+     */
+    default <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
+        return AnnotatedElements.getDirectOrIndirectAnnotationsByType(this, annotationClass);
+    }
+
+    /**
      * Returns all annotations that are directly present on this
      * element.  Unlike the other methods in this interface, this method
      * ignores inherited annotations.  (Returns an array of length zero if
@@ -113,34 +158,4 @@
      * @since 1.5
      */
     Annotation[] getDeclaredAnnotations();
-
-    /**
-     * Returns a directly-present annotation on {@code this} element, whose class is
-     * {@code annotationClass}, or {@code null} if nothing was found.
-     *
-     * @since 1.8
-     */
-    default <T extends Annotation> Annotation getDeclaredAnnotation(Class<T> annotationClass) {
-        return AnnotatedElements.getDeclaredAnnotation(this, annotationClass);
-    }
-
-    /**
-     * Returns a directly or indirectly present list of annotations on {@code this} element,
-     * whose class is {@code annotationClass}, or an empty array if nothing was found.
-     *
-     * @since 1.8
-     */
-    default <T extends Annotation> T[] getDeclaredAnnotationsByType(Class<T> annotationClass) {
-        return AnnotatedElements.getDeclaredAnnotationsByType(this, annotationClass);
-    }
-
-    /**
-     * Returns an associated list of annotations on {@code this} element,
-     * whose class is {@code annotationClass}, or an empty array if nothing was found.
-     *
-     * @since 1.8
-     */
-    default <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
-        return AnnotatedElements.getAnnotationsByType(this, annotationClass);
-    }
 }
diff --git a/ojluni/src/main/java/java/lang/reflect/Constructor.java b/ojluni/src/main/java/java/lang/reflect/Constructor.java
index 9742f0c..76ecabf 100644
--- a/ojluni/src/main/java/java/lang/reflect/Constructor.java
+++ b/ojluni/src/main/java/java/lang/reflect/Constructor.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,9 +26,7 @@
 
 package java.lang.reflect;
 
-import sun.reflect.CallerSensitive;
 import java.util.Comparator;
-import java.util.List;
 import libcore.reflect.Types;
 
 import java.lang.annotation.Annotation;
@@ -53,9 +51,7 @@
  * @author      Kenneth Russell
  * @author      Nakul Saraiya
  */
-public final class Constructor<T> extends AbstractMethod implements
-                                                    GenericDeclaration,
-                                                    Member {
+public final class Constructor<T> extends AbstractMethod {
     private static final Comparator<Method> ORDER_BY_SIGNATURE = null; // Unused; must match Method.
 
     private final Class<?> serializationClass;
@@ -79,10 +75,12 @@
     }
 
     /**
-     * Returns the {@code Class} object representing the class that declares
-     * the constructor represented by this {@code Constructor} object.
+     * {@inheritDoc}
      */
+    @Override
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public Class<T> getDeclaringClass() {
+        // Android-changed: This is handled by AbstractMethod.
         return (Class<T>) super.getDeclaringClass();
     }
 
@@ -90,124 +88,79 @@
      * Returns the name of this constructor, as a string.  This is
      * the binary name of the constructor's declaring class.
      */
+    @Override
     public String getName() {
         return getDeclaringClass().getName();
     }
 
     /**
-     * Returns the Java language modifiers for the constructor
-     * represented by this {@code Constructor} object, as an integer. The
-     * {@code Modifier} class should be used to decode the modifiers.
-     *
-     * @see Modifier
+     * {@inheritDoc}
      */
+    @Override
     public int getModifiers() {
+        // Android-changed: This is handled by AbstractMethod.
         return super.getModifiers();
     }
 
     /**
-     * Returns an array of {@code TypeVariable} objects that represent the
-     * type variables declared by the generic declaration represented by this
-     * {@code GenericDeclaration} object, in declaration order.  Returns an
-     * array of length 0 if the underlying generic declaration declares no type
-     * variables.
-     *
-     * @return an array of {@code TypeVariable} objects that represent
-     *     the type variables declared by this generic declaration
-     * @throws GenericSignatureFormatError if the generic
-     *     signature of this generic declaration does not conform to
-     *     the format specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
      * @since 1.5
      */
+    @Override
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public TypeVariable<Constructor<T>>[] getTypeParameters() {
-      GenericInfo info = getMethodOrConstructorGenericInfo();
-      return (TypeVariable<Constructor<T>>[]) info.formalTypeParameters.clone();
+        // Android-changed: This is mostly handled by AbstractMethod.
+        GenericInfo info = getMethodOrConstructorGenericInfoInternal();
+        return (TypeVariable<Constructor<T>>[]) info.formalTypeParameters.clone();
     }
 
-
     /**
-     * Returns an array of {@code Class} objects that represent the formal
-     * parameter types, in declaration order, of the constructor
-     * represented by this {@code Constructor} object.  Returns an array of
-     * length 0 if the underlying constructor takes no parameters.
-     *
-     * @return the parameter types for the constructor this object
-     * represents
+     * {@inheritDoc}
      */
+    @Override
     public Class<?>[] getParameterTypes() {
+        // Android-changed: This is handled by AbstractMethod.
         return super.getParameterTypes();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    public int getParameterCount() {
+        // Android-changed: This is handled by AbstractMethod.
+        return super.getParameterCount();
+    }
 
     /**
-     * Returns an array of {@code Type} objects that represent the formal
-     * parameter types, in declaration order, of the method represented by
-     * this {@code Constructor} object. Returns an array of length 0 if the
-     * underlying method takes no parameters.
-     *
-     * <p>If a formal parameter type is a parameterized type,
-     * the {@code Type} object returned for it must accurately reflect
-     * the actual type parameters used in the source code.
-     *
-     * <p>If a formal parameter type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of {@code Type}s that represent the formal
-     *     parameter types of the underlying method, in declaration order
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if any of the parameter
-     *     types of the underlying method refers to a non-existent type
-     *     declaration
-     * @throws MalformedParameterizedTypeException if any of
-     *     the underlying method's parameter types refer to a parameterized
-     *     type that cannot be instantiated for any reason
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public Type[] getGenericParameterTypes() {
         return super.getGenericParameterTypes();
     }
 
-
     /**
-     * Returns an array of {@code Class} objects that represent the types
-     * of exceptions declared to be thrown by the underlying constructor
-     * represented by this {@code Constructor} object.  Returns an array of
-     * length 0 if the constructor declares no exceptions in its {@code throws} clause.
-     *
-     * @return the exception types declared as being thrown by the
-     * constructor this object represents
+     * {@inheritDoc}
      */
+    @Override
     public native Class<?>[] getExceptionTypes();
 
     /**
-     * Returns an array of {@code Type} objects that represent the
-     * exceptions declared to be thrown by this {@code Constructor} object.
-     * Returns an array of length 0 if the underlying method declares
-     * no exceptions in its {@code throws} clause.
-     *
-     * <p>If an exception type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of Types that represent the exception types
-     *     thrown by the underlying method
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if the underlying method's
-     *     {@code throws} clause refers to a non-existent type declaration
-     * @throws MalformedParameterizedTypeException if
-     *     the underlying method's {@code throws} clause refers to a
-     *     parameterized type that cannot be instantiated for any reason
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
      * @since 1.5
      */
-      public Type[] getGenericExceptionTypes() {
-          return super.getGenericExceptionTypes();
-      }
+    @Override
+    public Type[] getGenericExceptionTypes() {
+        return super.getGenericExceptionTypes();
+    }
 
     /**
      * Compares this {@code Constructor} against the specified object.
@@ -219,17 +172,8 @@
         if (obj != null && obj instanceof Constructor) {
             Constructor<?> other = (Constructor<?>)obj;
             if (getDeclaringClass() == other.getDeclaringClass()) {
-                /* Avoid unnecessary cloning */
                 // Android changed: Use getParameterTypes.
-                Class<?>[] params1 = getParameterTypes();
-                Class<?>[] params2 = other.getParameterTypes();
-                if (params1.length == params2.length) {
-                    for (int i = 0; i < params1.length; i++) {
-                        if (params1[i] != params2[i])
-                            return false;
-                    }
-                    return true;
-                }
+                return equalParamTypes(getParameterTypes(), other.getParameterTypes());
             }
         }
         return false;
@@ -258,36 +202,21 @@
      * modifiers {@code public}, {@code protected} or
      * {@code private}.  Only one of these may appear, or none if the
      * constructor has default (package) access.
+     *
+     * @return a string describing this {@code Constructor}
+     * @jls 8.8.3. Constructor Modifiers
      */
     public String toString() {
-        try {
-            StringBuffer sb = new StringBuffer();
-            int mod = getModifiers() & Modifier.constructorModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod) + " ");
-            }
-            sb.append(Field.getTypeName(getDeclaringClass()));
-            sb.append("(");
-            Class<?>[] params = getParameterTypes();
-            for (int j = 0; j < params.length; j++) {
-                sb.append(Field.getTypeName(params[j]));
-                if (j < (params.length - 1))
-                    sb.append(",");
-            }
-            sb.append(")");
-            Class<?>[] exceptions = getExceptionTypes();
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append(exceptions[k].getName());
-                    if (k < (exceptions.length - 1))
-                        sb.append(",");
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        // Android changed: Use getParameterTypes.
+        return sharedToString(Modifier.constructorModifiers(),
+                              false,
+                              getParameterTypes(),
+                              getExceptionTypes());
+    }
+
+    @Override
+    void specificToStringHeader(StringBuilder sb) {
+        sb.append(getDeclaringClass().getTypeName());
     }
 
     /**
@@ -322,57 +251,16 @@
      * include type parameters
      *
      * @since 1.5
+     * @jls 8.8.3. Constructor Modifiers
      */
+    @Override
     public String toGenericString() {
-        try {
-            StringBuilder sb = new StringBuilder();
-            int mod = getModifiers() & Modifier.constructorModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod) + " ");
-            }
-            TypeVariable<?>[] typeparms = getTypeParameters();
-            if (typeparms.length > 0) {
-                boolean first = true;
-                sb.append("<");
-                for(TypeVariable<?> typeparm: typeparms) {
-                    if (!first)
-                        sb.append(",");
-                    // Class objects can't occur here; no need to test
-                    // and call Class.getName().
-                    sb.append(typeparm.toString());
-                    first = false;
-                }
-                sb.append("> ");
-            }
-            sb.append(Field.getTypeName(getDeclaringClass()));
-            sb.append("(");
-            Type[] params = getGenericParameterTypes();
-            for (int j = 0; j < params.length; j++) {
-                String param = (params[j] instanceof Class<?>)?
-                    Field.getTypeName((Class<?>)params[j]):
-                    (params[j].toString());
-                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
-                    param = param.replaceFirst("\\[\\]$", "...");
-                sb.append(param);
-                if (j < (params.length - 1))
-                    sb.append(",");
-            }
-            sb.append(")");
-            Type[] exceptions = getGenericExceptionTypes();
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append((exceptions[k] instanceof Class)?
-                              ((Class<?>)exceptions[k]).getName():
-                              exceptions[k].toString());
-                    if (k < (exceptions.length - 1))
-                        sb.append(",");
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        return sharedToGenericString(Modifier.constructorModifiers(), false);
+    }
+
+    @Override
+    void specificToGenericStringHeader(StringBuilder sb) {
+        specificToStringHeader(sb);
     }
 
     /**
@@ -440,29 +328,22 @@
             IllegalAccessException, IllegalArgumentException, InvocationTargetException;
 
     /**
-     * Returns {@code true} if this constructor was declared to take
-     * a variable number of arguments; returns {@code false}
-     * otherwise.
-     *
-     * @return {@code true} if an only if this constructor was declared to
-     * take a variable number of arguments.
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public boolean isVarArgs() {
-        return (getModifiers() & Modifier.VARARGS) != 0;
+        return super.isVarArgs();
     }
 
     /**
-     * Returns {@code true} if this constructor is a synthetic
-     * constructor; returns {@code false} otherwise.
-     *
-     * @return true if and only if this constructor is a synthetic
-     * constructor as defined by
-     * <cite>The Java&trade; Language Specification</cite>.
+     * {@inheritDoc}
+     * @jls 13.1 The Form of a Binary
      * @since 1.5
      */
+    @Override
     public boolean isSynthetic() {
-        return Modifier.isSynthetic(getModifiers());
+        return super.isSynthetic();
     }
 
     String getSignature() {
@@ -479,52 +360,29 @@
     }
 
     /**
-     * @throws NullPointerException {@inheritDoc}
+     * {@inheritDoc}
+     * @throws NullPointerException  {@inheritDoc}
      * @since 1.5
      */
-    @Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
-        if (annotationType == null) {
-            throw new NullPointerException("annotationType == null");
-        }
-        return getAnnotationNative(annotationType);
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return super.getAnnotation(annotationClass);
     }
-    private native <A extends Annotation> A getAnnotationNative(Class<A> annotationType);
 
     /**
+     * {@inheritDoc}
      * @since 1.5
      */
-    @Override public native Annotation[] getDeclaredAnnotations();
-
-    @Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
-        if (annotationType == null) {
-            throw new NullPointerException("annotationType == null");
-        }
-        return isAnnotationPresentNative(annotationType);
+    public Annotation[] getDeclaredAnnotations()  {
+        return super.getDeclaredAnnotations();
     }
-    private native boolean isAnnotationPresentNative(Class<? extends Annotation> annotationType);
 
     /**
-     * Returns an array of arrays that represent the annotations on the formal
-     * parameters, in declaration order, of the method represented by
-     * this {@code Constructor} object. (Returns an array of length zero if the
-     * underlying method is parameterless.  If the method has one or more
-     * parameters, a nested array of length zero is returned for each parameter
-     * with no annotations.) The annotation objects contained in the returned
-     * arrays are serializable.  The caller of this method is free to modify
-     * the returned arrays; it will have no effect on the arrays returned to
-     * other callers.
-     *
-     * @return an array of arrays that represent the annotations on the formal
-     *    parameters, in declaration order, of the method represented by this
-     *    Constructor object
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public Annotation[][] getParameterAnnotations() {
-        Annotation[][] parameterAnnotations = getParameterAnnotationsNative();
-        if (parameterAnnotations == null) {
-          parameterAnnotations = new Annotation[getParameterTypes().length][0];
-        }
-        return parameterAnnotations;
+        // Android-changed: This is handled by AbstractMethod.
+        return super.getParameterAnnotations();
     }
-    private native Annotation[][] getParameterAnnotationsNative();
 }
diff --git a/ojluni/src/main/java/java/lang/reflect/Executable.java b/ojluni/src/main/java/java/lang/reflect/Executable.java
new file mode 100644
index 0000000..1840566
--- /dev/null
+++ b/ojluni/src/main/java/java/lang/reflect/Executable.java
@@ -0,0 +1,384 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.reflect;
+
+import java.lang.annotation.Annotation;
+import libcore.reflect.AnnotatedElements;
+
+/**
+ * A shared superclass for the common functionality of {@link Method}
+ * and {@link Constructor}.
+ *
+ * @since 1.8
+ */
+public abstract class Executable extends AccessibleObject
+    implements Member, GenericDeclaration {
+    /*
+     * Only grant package-visibility to the constructor.
+     */
+    Executable() {}
+
+    boolean equalParamTypes(Class<?>[] params1, Class<?>[] params2) {
+        /* Avoid unnecessary cloning */
+        if (params1.length == params2.length) {
+            for (int i = 0; i < params1.length; i++) {
+                if (params1[i] != params2[i])
+                    return false;
+            }
+            return true;
+        }
+        return false;
+    }
+
+    void separateWithCommas(Class<?>[] types, StringBuilder sb) {
+        for (int j = 0; j < types.length; j++) {
+            sb.append(types[j].getTypeName());
+            if (j < (types.length - 1))
+                sb.append(",");
+        }
+
+    }
+
+    void printModifiersIfNonzero(StringBuilder sb, int mask, boolean isDefault) {
+        int mod = getModifiers() & mask;
+
+        if (mod != 0 && !isDefault) {
+            sb.append(Modifier.toString(mod)).append(' ');
+        } else {
+            int access_mod = mod & Modifier.ACCESS_MODIFIERS;
+            if (access_mod != 0)
+                sb.append(Modifier.toString(access_mod)).append(' ');
+            if (isDefault)
+                sb.append("default ");
+            mod = (mod & ~Modifier.ACCESS_MODIFIERS);
+            if (mod != 0)
+                sb.append(Modifier.toString(mod)).append(' ');
+        }
+    }
+
+    String sharedToString(int modifierMask,
+                          boolean isDefault,
+                          Class<?>[] parameterTypes,
+                          Class<?>[] exceptionTypes) {
+        try {
+            StringBuilder sb = new StringBuilder();
+
+            printModifiersIfNonzero(sb, modifierMask, isDefault);
+            specificToStringHeader(sb);
+
+            sb.append('(');
+            separateWithCommas(parameterTypes, sb);
+            sb.append(')');
+            if (exceptionTypes.length > 0) {
+                sb.append(" throws ");
+                separateWithCommas(exceptionTypes, sb);
+            }
+            return sb.toString();
+        } catch (Exception e) {
+            return "<" + e + ">";
+        }
+    }
+
+    /**
+     * Generate toString header information specific to a method or
+     * constructor.
+     */
+    abstract void specificToStringHeader(StringBuilder sb);
+
+
+    String sharedToGenericString(int modifierMask, boolean isDefault) {
+        try {
+            StringBuilder sb = new StringBuilder();
+
+            printModifiersIfNonzero(sb, modifierMask, isDefault);
+
+            TypeVariable<?>[] typeparms = getTypeParameters();
+            if (typeparms.length > 0) {
+                boolean first = true;
+                sb.append('<');
+                for(TypeVariable<?> typeparm: typeparms) {
+                    if (!first)
+                        sb.append(',');
+                    // Class objects can't occur here; no need to test
+                    // and call Class.getName().
+                    sb.append(typeparm.toString());
+                    first = false;
+                }
+                sb.append("> ");
+            }
+
+            specificToGenericStringHeader(sb);
+
+            sb.append('(');
+            Type[] params = getGenericParameterTypes();
+            for (int j = 0; j < params.length; j++) {
+                String param = params[j].getTypeName();
+                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
+                    param = param.replaceFirst("\\[\\]$", "...");
+                sb.append(param);
+                if (j < (params.length - 1))
+                    sb.append(',');
+            }
+            sb.append(')');
+            Type[] exceptions = getGenericExceptionTypes();
+            if (exceptions.length > 0) {
+                sb.append(" throws ");
+                for (int k = 0; k < exceptions.length; k++) {
+                    sb.append((exceptions[k] instanceof Class)?
+                              ((Class)exceptions[k]).getName():
+                              exceptions[k].toString());
+                    if (k < (exceptions.length - 1))
+                        sb.append(',');
+                }
+            }
+            return sb.toString();
+        } catch (Exception e) {
+            return "<" + e + ">";
+        }
+    }
+
+    /**
+     * Generate toGenericString header information specific to a
+     * method or constructor.
+     */
+    abstract void specificToGenericStringHeader(StringBuilder sb);
+
+    /**
+     * Returns the {@code Class} object representing the class or interface
+     * that declares the executable represented by this object.
+     */
+    public abstract Class<?> getDeclaringClass();
+
+    /**
+     * Returns the name of the executable represented by this object.
+     */
+    public abstract String getName();
+
+    /**
+     * Returns the Java language {@linkplain Modifier modifiers} for
+     * the executable represented by this object.
+     */
+    public abstract int getModifiers();
+
+    /**
+     * Returns an array of {@code TypeVariable} objects that represent the
+     * type variables declared by the generic declaration represented by this
+     * {@code GenericDeclaration} object, in declaration order.  Returns an
+     * array of length 0 if the underlying generic declaration declares no type
+     * variables.
+     *
+     * @return an array of {@code TypeVariable} objects that represent
+     *     the type variables declared by this generic declaration
+     * @throws GenericSignatureFormatError if the generic
+     *     signature of this generic declaration does not conform to
+     *     the format specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     */
+    public abstract TypeVariable<?>[] getTypeParameters();
+
+    /**
+     * Returns an array of {@code Class} objects that represent the formal
+     * parameter types, in declaration order, of the executable
+     * represented by this object.  Returns an array of length
+     * 0 if the underlying executable takes no parameters.
+     *
+     * @return the parameter types for the executable this object
+     * represents
+     */
+    public abstract Class<?>[] getParameterTypes();
+
+    /**
+     * Returns the number of formal parameters (whether explicitly
+     * declared or implicitly declared or neither) for the executable
+     * represented by this object.
+     *
+     * @since 1.8
+     * @return The number of formal parameters for the executable this
+     * object represents
+     */
+    public int getParameterCount() {
+        throw new AbstractMethodError();
+    }
+
+    /**
+     * Returns an array of {@code Type} objects that represent the formal
+     * parameter types, in declaration order, of the executable represented by
+     * this object. Returns an array of length 0 if the
+     * underlying executable takes no parameters.
+     *
+     * <p>If a formal parameter type is a parameterized type,
+     * the {@code Type} object returned for it must accurately reflect
+     * the actual type parameters used in the source code.
+     *
+     * <p>If a formal parameter type is a type variable or a parameterized
+     * type, it is created. Otherwise, it is resolved.
+     *
+     * @return an array of {@code Type}s that represent the formal
+     *     parameter types of the underlying executable, in declaration order
+     * @throws GenericSignatureFormatError
+     *     if the generic method signature does not conform to the format
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * @throws TypeNotPresentException if any of the parameter
+     *     types of the underlying executable refers to a non-existent type
+     *     declaration
+     * @throws MalformedParameterizedTypeException if any of
+     *     the underlying executable's parameter types refer to a parameterized
+     *     type that cannot be instantiated for any reason
+     */
+    public Type[] getGenericParameterTypes() {
+        // Android-changed: Implemented in AbstractMethod instead.
+        throw new UnsupportedOperationException(
+                "Executable.getGenericParameterTypes() not implemented");
+    }
+
+    /**
+     * Returns an array of {@code Class} objects that represent the
+     * types of exceptions declared to be thrown by the underlying
+     * executable represented by this object.  Returns an array of
+     * length 0 if the executable declares no exceptions in its {@code
+     * throws} clause.
+     *
+     * @return the exception types declared as being thrown by the
+     * executable this object represents
+     */
+    public abstract Class<?>[] getExceptionTypes();
+
+    /**
+     * Returns an array of {@code Type} objects that represent the
+     * exceptions declared to be thrown by this executable object.
+     * Returns an array of length 0 if the underlying executable declares
+     * no exceptions in its {@code throws} clause.
+     *
+     * <p>If an exception type is a type variable or a parameterized
+     * type, it is created. Otherwise, it is resolved.
+     *
+     * @return an array of Types that represent the exception types
+     *     thrown by the underlying executable
+     * @throws GenericSignatureFormatError
+     *     if the generic method signature does not conform to the format
+     *     specified in
+     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * @throws TypeNotPresentException if the underlying executable's
+     *     {@code throws} clause refers to a non-existent type declaration
+     * @throws MalformedParameterizedTypeException if
+     *     the underlying executable's {@code throws} clause refers to a
+     *     parameterized type that cannot be instantiated for any reason
+     */
+    public Type[] getGenericExceptionTypes() {
+        // Android-changed: Implemented in AbstractMethod instead.
+        throw new UnsupportedOperationException(
+                "Executable.getGenericExceptionTypes() not implemented");
+    }
+
+    /**
+     * Returns a string describing this {@code Executable}, including
+     * any type parameters.
+     * @return a string describing this {@code Executable}, including
+     * any type parameters
+     */
+    public abstract String toGenericString();
+
+    /**
+     * Returns {@code true} if this executable was declared to take a
+     * variable number of arguments; returns {@code false} otherwise.
+     *
+     * @return {@code true} if an only if this executable was declared
+     * to take a variable number of arguments.
+     */
+    public boolean isVarArgs()  {
+        return (getModifiers() & Modifier.VARARGS) != 0;
+    }
+
+    /**
+     * Returns {@code true} if this executable is a synthetic
+     * construct; returns {@code false} otherwise.
+     *
+     * @return true if and only if this executable is a synthetic
+     * construct as defined by
+     * <cite>The Java&trade; Language Specification</cite>.
+     * @jls 13.1 The Form of a Binary
+     */
+    public boolean isSynthetic() {
+        return Modifier.isSynthetic(getModifiers());
+    }
+
+    /**
+     * Returns an array of arrays of {@code Annotation}s that
+     * represent the annotations on the formal parameters, in
+     * declaration order, of the {@code Executable} represented by
+     * this object.  Synthetic and mandated parameters (see
+     * explanation below), such as the outer "this" parameter to an
+     * inner class constructor will be represented in the returned
+     * array.  If the executable has no parameters (meaning no formal,
+     * no synthetic, and no mandated parameters), a zero-length array
+     * will be returned.  If the {@code Executable} has one or more
+     * parameters, a nested array of length zero is returned for each
+     * parameter with no annotations. The annotation objects contained
+     * in the returned arrays are serializable.  The caller of this
+     * method is free to modify the returned arrays; it will have no
+     * effect on the arrays returned to other callers.
+     *
+     * A compiler may add extra parameters that are implicitly
+     * declared in source ("mandated"), as well as parameters that
+     * are neither implicitly nor explicitly declared in source
+     * ("synthetic") to the parameter list for a method.
+     *
+     * @return an array of arrays that represent the annotations on
+     *    the formal and implicit parameters, in declaration order, of
+     *    the executable represented by this object
+     */
+    public abstract Annotation[][] getParameterAnnotations();
+
+    /**
+     * {@inheritDoc}
+     * @throws NullPointerException  {@inheritDoc}
+     */
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        // Android-changed: Implemented in AbstractMethod instead.
+        throw new UnsupportedOperationException("Executable.getAnnotation(Class) not implemented");
+    }
+
+    /**
+     * {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
+        // Android-changed: Uses AnnotatedElements instead.
+        return AnnotatedElements.getDirectOrIndirectAnnotationsByType(this, annotationClass);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Annotation[] getDeclaredAnnotations()  {
+        // Android-changed: Implemented in AbstractMethod instead.
+        throw new UnsupportedOperationException(
+                "Executable.getDeclaredAnnotations() not implemented");
+    }
+}
diff --git a/ojluni/src/main/java/java/lang/reflect/Field.java b/ojluni/src/main/java/java/lang/reflect/Field.java
index 315b1ed..db56ba4 100644
--- a/ojluni/src/main/java/java/lang/reflect/Field.java
+++ b/ojluni/src/main/java/java/lang/reflect/Field.java
@@ -26,13 +26,11 @@
 
 package java.lang.reflect;
 
-import sun.reflect.CallerSensitive;
-import sun.reflect.Reflection;
-import java.lang.annotation.Annotation;
-import java.util.Map;
 import com.android.dex.Dex;
+
+import java.lang.annotation.Annotation;
+import libcore.reflect.AnnotatedElements;
 import libcore.reflect.GenericSignatureParser;
-import java.util.List;
 
 
 /**
@@ -849,6 +847,18 @@
     }
     private native <A extends Annotation> A getAnnotationNative(Class<A> annotationType);
 
+    /**
+     * {@inheritDoc}
+     * @throws NullPointerException {@inheritDoc}
+     * @since 1.8
+     */
+    @Override
+    public <T extends Annotation> T[] getAnnotationsByType(Class<T> annotationClass) {
+        // Android-changed: Uses AnnotatedElements instead.
+        return AnnotatedElements.getDirectOrIndirectAnnotationsByType(this, annotationClass);
+    }
+
+
     @Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) {
         if (annotationType == null) {
             throw new NullPointerException("annotationType == null");
diff --git a/ojluni/src/main/java/java/lang/reflect/Method.java b/ojluni/src/main/java/java/lang/reflect/Method.java
index 8ee7bd5..ec0cdcf 100644
--- a/ojluni/src/main/java/java/lang/reflect/Method.java
+++ b/ojluni/src/main/java/java/lang/reflect/Method.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,12 +26,8 @@
 
 package java.lang.reflect;
 
-import sun.reflect.CallerSensitive;
 import java.lang.annotation.Annotation;
-import java.lang.annotation.AnnotationFormatError;
-import com.android.dex.Dex;
 import java.util.Comparator;
-import java.util.List;
 import libcore.reflect.Types;
 
 /**
@@ -54,9 +50,7 @@
  * @author Kenneth Russell
  * @author Nakul Saraiya
  */
-public final
-    class Method extends AbstractMethod implements GenericDeclaration,
-                                                     Member {
+public final class Method extends AbstractMethod  {
     /**
      * Orders methods by their name, parameters and return type.
      *
@@ -69,7 +63,7 @@
             }
             int comparison = a.getName().compareTo(b.getName());
             if (comparison == 0) {
-                comparison = a.compareParameters(b.getParameterTypes());
+                comparison = a.compareMethodParametersInternal(b.getParameterTypes());
                 if (comparison == 0) {
                     // This is necessary for methods that have covariant return types.
                     Class<?> aReturnType = a.getReturnType();
@@ -89,10 +83,11 @@
     }
 
     /**
-     * Returns the {@code Class} object representing the class or interface
-     * that declares the method represented by this {@code Method} object.
-     */
+     * {@inheritDoc}
+      */
+    @Override
     public Class<?> getDeclaringClass() {
+        // Android-changed: This is handled by AbstractMethod.
         return super.getDeclaringClass();
     }
 
@@ -100,40 +95,31 @@
      * Returns the name of the method represented by this {@code Method}
      * object, as a {@code String}.
      */
+    @Override
     public String getName() {
-        Dex dex = declaringClassOfOverriddenMethod.getDex();
-        int nameIndex = dex.nameIndexFromMethodIndex(dexMethodIndex);
-        return declaringClassOfOverriddenMethod.getDexCacheString(dex, nameIndex);
+        // Android-changed: This is handled by AbstractMethod.
+        return getMethodNameInternal();
     }
 
     /**
-     * Returns the Java language modifiers for the method represented
-     * by this {@code Method} object, as an integer. The {@code Modifier} class should
-     * be used to decode the modifiers.
-     *
-     * @see Modifier
+     * {@inheritDoc}
      */
+    @Override
     public int getModifiers() {
+        // Android-changed: This is handled by AbstractMethod.
         return super.getModifiers();
     }
 
     /**
-     * Returns an array of {@code TypeVariable} objects that represent the
-     * type variables declared by the generic declaration represented by this
-     * {@code GenericDeclaration} object, in declaration order.  Returns an
-     * array of length 0 if the underlying generic declaration declares no type
-     * variables.
-     *
-     * @return an array of {@code TypeVariable} objects that represent
-     *     the type variables declared by this generic declaration
-     * @throws GenericSignatureFormatError if the generic
-     *     signature of this generic declaration does not conform to
-     *     the format specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
      * @since 1.5
      */
+    @Override
+    @SuppressWarnings({"rawtypes", "unchecked"})
     public TypeVariable<Method>[] getTypeParameters() {
-        GenericInfo info = getMethodOrConstructorGenericInfo();
+        // Android-changed: This is mostly handled by AbstractMethod.
+        GenericInfo info = getMethodOrConstructorGenericInfoInternal();
         return (TypeVariable<Method>[]) info.formalTypeParameters.clone();
     }
 
@@ -144,10 +130,8 @@
      * @return the return type for the method this object represents
      */
     public Class<?> getReturnType() {
-        Dex dex = declaringClassOfOverriddenMethod.getDex();
-        int returnTypeIndex = dex.returnTypeIndexFromMethodIndex(dexMethodIndex);
-        // Note, in the case of a Proxy the dex cache types are equal.
-        return declaringClassOfOverriddenMethod.getDexCacheType(dex, returnTypeIndex);
+        // Android-changed: This is handled by AbstractMethod.
+        return getMethodReturnTypeInternal();
     }
 
     /**
@@ -175,91 +159,54 @@
      * @since 1.5
      */
     public Type getGenericReturnType() {
-      return Types.getType(getMethodOrConstructorGenericInfo().genericReturnType);
+      return Types.getType(getMethodOrConstructorGenericInfoInternal().genericReturnType);
     }
 
-
     /**
-     * Returns an array of {@code Class} objects that represent the formal
-     * parameter types, in declaration order, of the method
-     * represented by this {@code Method} object.  Returns an array of length
-     * 0 if the underlying method takes no parameters.
-     *
-     * @return the parameter types for the method this object
-     * represents
+     * {@inheritDoc}
      */
     @Override
     public Class<?>[] getParameterTypes() {
+        // Android-changed: This is handled by AbstractMethod.
         return super.getParameterTypes();
     }
 
     /**
-     * Returns an array of {@code Type} objects that represent the formal
-     * parameter types, in declaration order, of the method represented by
-     * this {@code Method} object. Returns an array of length 0 if the
-     * underlying method takes no parameters.
-     *
-     * <p>If a formal parameter type is a parameterized type,
-     * the {@code Type} object returned for it must accurately reflect
-     * the actual type parameters used in the source code.
-     *
-     * <p>If a formal parameter type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of Types that represent the formal
-     *     parameter types of the underlying method, in declaration order
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if any of the parameter
-     *     types of the underlying method refers to a non-existent type
-     *     declaration
-     * @throws MalformedParameterizedTypeException if any of
-     *     the underlying method's parameter types refer to a parameterized
-     *     type that cannot be instantiated for any reason
-     * @since 1.5
+     * {@inheritDoc}
      */
-    public Type[] getGenericParameterTypes() {
-        return Types.getTypeArray(getMethodOrConstructorGenericInfo().genericParameterTypes, false);
+    public int getParameterCount() {
+        // Android-changed: This is handled by AbstractMethod.
+        return super.getParameterCount();
     }
 
     /**
-     * Returns an array of {@code Class} objects that represent
-     * the types of the exceptions declared to be thrown
-     * by the underlying method
-     * represented by this {@code Method} object.  Returns an array of length
-     * 0 if the method declares no exceptions in its {@code throws} clause.
-     *
-     * @return the exception types declared as being thrown by the
-     * method this object represents
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
+     * @since 1.5
      */
+    @Override
+    public Type[] getGenericParameterTypes() {
+        return super.getGenericParameterTypes();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     public native Class<?>[] getExceptionTypes();
 
     /**
-     * Returns an array of {@code Type} objects that represent the
-     * exceptions declared to be thrown by this {@code Method} object.
-     * Returns an array of length 0 if the underlying method declares
-     * no exceptions in its {@code throws} clause.
-     *
-     * <p>If an exception type is a type variable or a parameterized
-     * type, it is created. Otherwise, it is resolved.
-     *
-     * @return an array of Types that represent the exception types
-     *     thrown by the underlying method
-     * @throws GenericSignatureFormatError
-     *     if the generic method signature does not conform to the format
-     *     specified in
-     *     <cite>The Java&trade; Virtual Machine Specification</cite>
-     * @throws TypeNotPresentException if the underlying method's
-     *     {@code throws} clause refers to a non-existent type declaration
-     * @throws MalformedParameterizedTypeException if
-     *     the underlying method's {@code throws} clause refers to a
-     *     parameterized type that cannot be instantiated for any reason
+     * {@inheritDoc}
+     * @throws GenericSignatureFormatError {@inheritDoc}
+     * @throws TypeNotPresentException {@inheritDoc}
+     * @throws MalformedParameterizedTypeException {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public Type[] getGenericExceptionTypes() {
-        return Types.getTypeArray(getMethodOrConstructorGenericInfo().genericExceptionTypes, false);
+        return super.getGenericExceptionTypes();
     }
 
     /**
@@ -275,16 +222,8 @@
                 && (getName() == other.getName())) {
                 if (!getReturnType().equals(other.getReturnType()))
                     return false;
-                /* Avoid unnecessary cloning */
-                Class<?>[] params1 = getParameterTypes();
-                Class<?>[] params2 = other.getParameterTypes();
-                if (params1.length == params2.length) {
-                    for (int i = 0; i < params1.length; i++) {
-                        if (params1[i] != params2[i])
-                            return false;
-                    }
-                    return true;
-                }
+                // Android changed: Use getParameterTypes.
+                return equalParamTypes(getParameterTypes(), other.getParameterTypes());
             }
         }
         return false;
@@ -299,6 +238,7 @@
         return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
     }
 
+
     /**
      * Returns a string describing this {@code Method}.  The string is
      * formatted as the method access modifiers, if any, followed by
@@ -318,39 +258,26 @@
      * specified by "The Java Language Specification".  This is
      * {@code public}, {@code protected} or {@code private} first,
      * and then other modifiers in the following order:
-     * {@code abstract}, {@code static}, {@code final},
+     * {@code abstract}, {@code default}, {@code static}, {@code final},
      * {@code synchronized}, {@code native}, {@code strictfp}.
+     *
+     * @return a string describing this {@code Method}
+     *
+     * @jls 8.4.3 Method Modifiers
      */
     public String toString() {
-        try {
-            StringBuilder sb = new StringBuilder();
-            int mod = getModifiers() & Modifier.methodModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod)).append(' ');
-            }
-            sb.append(Field.getTypeName(getReturnType())).append(' ');
-            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
-            sb.append(getName()).append('(');
-            Class<?>[] params = getParameterTypes();
-            for (int j = 0; j < params.length; j++) {
-                sb.append(Field.getTypeName(params[j]));
-                if (j < (params.length - 1))
-                    sb.append(',');
-            }
-            sb.append(')');
-            Class<?>[] exceptions = getExceptionTypes();
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append(exceptions[k].getName());
-                    if (k < (exceptions.length - 1))
-                        sb.append(',');
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        // Android changed: Use getParameterTypes.
+        return sharedToString(Modifier.methodModifiers(),
+                              isDefault(),
+                              getParameterTypes(),
+                              getExceptionTypes());
+    }
+
+    @Override
+    void specificToStringHeader(StringBuilder sb) {
+        sb.append(getReturnType().getTypeName()).append(' ');
+        sb.append(getDeclaringClass().getTypeName()).append('.');
+        sb.append(getName());
     }
 
     /**
@@ -376,79 +303,36 @@
      * class name.  If the method is declared to throw exceptions, the
      * parameter list is followed by a space, followed by the word
      * throws followed by a comma-separated list of the generic thrown
-     * exception types.  If there are no type parameters, the type
-     * parameter list is elided.
+     * exception types.
      *
      * <p>The access modifiers are placed in canonical order as
      * specified by "The Java Language Specification".  This is
      * {@code public}, {@code protected} or {@code private} first,
      * and then other modifiers in the following order:
-     * {@code abstract}, {@code static}, {@code final},
+     * {@code abstract}, {@code default}, {@code static}, {@code final},
      * {@code synchronized}, {@code native}, {@code strictfp}.
      *
      * @return a string describing this {@code Method},
      * include type parameters
      *
      * @since 1.5
+     *
+     * @jls 8.4.3 Method Modifiers
      */
+    @Override
     public String toGenericString() {
-        try {
-            StringBuilder sb = new StringBuilder();
-            int mod = getModifiers() & Modifier.methodModifiers();
-            if (mod != 0) {
-                sb.append(Modifier.toString(mod)).append(' ');
-            }
-            TypeVariable<?>[] typeparms = getTypeParameters();
-            if (typeparms.length > 0) {
-                boolean first = true;
-                sb.append('<');
-                for(TypeVariable<?> typeparm: typeparms) {
-                    if (!first)
-                        sb.append(',');
-                    // Class objects can't occur here; no need to test
-                    // and call Class.getName().
-                    sb.append(typeparm.toString());
-                    first = false;
-                }
-                sb.append("> ");
-            }
-
-            Type genRetType = getGenericReturnType();
-            sb.append( ((genRetType instanceof Class<?>)?
-                        Field.getTypeName((Class<?>)genRetType):genRetType.toString()))
-                    .append(' ');
-
-            sb.append(Field.getTypeName(getDeclaringClass())).append('.');
-            sb.append(getName()).append('(');
-            Type[] params = getGenericParameterTypes();
-            for (int j = 0; j < params.length; j++) {
-                String param = (params[j] instanceof Class)?
-                    Field.getTypeName((Class)params[j]):
-                    (params[j].toString());
-                if (isVarArgs() && (j == params.length - 1)) // replace T[] with T...
-                    param = param.replaceFirst("\\[\\]$", "...");
-                sb.append(param);
-                if (j < (params.length - 1))
-                    sb.append(',');
-            }
-            sb.append(')');
-            Type[] exceptions = getGenericExceptionTypes();
-            if (exceptions.length > 0) {
-                sb.append(" throws ");
-                for (int k = 0; k < exceptions.length; k++) {
-                    sb.append((exceptions[k] instanceof Class)?
-                              ((Class)exceptions[k]).getName():
-                              exceptions[k].toString());
-                    if (k < (exceptions.length - 1))
-                        sb.append(',');
-                }
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            return "<" + e + ">";
-        }
+        return sharedToGenericString(Modifier.methodModifiers(), isDefault());
     }
 
+    @Override
+    void specificToGenericStringHeader(StringBuilder sb) {
+        Type genRetType = getGenericReturnType();
+        sb.append(genRetType.getTypeName()).append(' ');
+        sb.append(getDeclaringClass().getTypeName()).append('.');
+        sb.append(getName());
+    }
+
+
     /**
      * Invokes the underlying method represented by this {@code Method}
      * object, on the specified object with the specified parameters.
@@ -480,7 +364,7 @@
      * underlying method return type is void, the invocation returns
      * null.
      *
-     * @param receiver  the object the underlying method is invoked from
+     * @param obj  the object the underlying method is invoked from
      * @param args the arguments used for the method call
      * @return the result of dispatching the method represented by
      * this object on {@code obj} with parameters
@@ -506,7 +390,7 @@
      * @exception ExceptionInInitializerError if the initialization
      * provoked by this method fails.
      */
-    public native Object invoke(Object receiver, Object... args)
+    public native Object invoke(Object obj, Object... args)
             throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
 
     /**
@@ -518,47 +402,48 @@
      * @since 1.5
      */
     public boolean isBridge() {
-        return (getModifiers() & Modifier.BRIDGE) != 0;
+        // Android-changed: This is handled by AbstractMethod.
+        return super.isBridgeMethodInternal();
     }
 
     /**
-     * Returns {@code true} if this method was declared to take
-     * a variable number of arguments; returns {@code false}
-     * otherwise.
-     *
-     * @return {@code true} if an only if this method was declared to
-     * take a variable number of arguments.
+     * {@inheritDoc}
      * @since 1.5
      */
+    @Override
     public boolean isVarArgs() {
-        return (getModifiers() & Modifier.VARARGS) != 0;
+        return super.isVarArgs();
     }
 
     /**
-     * Returns {@code true} if this method is a synthetic
+     * {@inheritDoc}
+     * @jls 13.1 The Form of a Binary
+     * @since 1.5
+     */
+    @Override
+    public boolean isSynthetic() {
+        return super.isSynthetic();
+    }
+
+
+    /**
+     * Returns {@code true} if this method is a default
      * method; returns {@code false} otherwise.
      *
-     * @return true if and only if this method is a synthetic
+     * A default method is a public non-abstract instance method, that
+     * is, a non-static method with a body, declared in an interface
+     * type.
+     *
+     * @return true if and only if this method is a default
      * method as defined by the Java Language Specification.
-     * @since 1.5
+     * @since 1.8
      */
-    public boolean isSynthetic() {
-        return Modifier.isSynthetic(getModifiers());
+    public boolean isDefault() {
+        // Android-changed: This is handled by AbstractMethod.
+        return super.isDefaultMethodInternal();
     }
 
     /**
-     * @throws NullPointerException {@inheritDoc}
-     * @since 1.5
-     */
-    @Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
-        if (annotationType == null) {
-            throw new NullPointerException("annotationType == null");
-        }
-        return getAnnotationNative(annotationType);
-    }
-    private native <A extends Annotation> A getAnnotationNative(Class<A> annotationType);
-
-    /**
      * Returns the default value for the annotation member represented by
      * this {@code Method} instance.  If the member is of a primitive type,
      * an instance of the corresponding wrapper type is returned. Returns
@@ -575,29 +460,31 @@
     public native Object getDefaultValue();
 
     /**
-     * Returns an array of arrays that represent the annotations on the formal
-     * parameters, in declaration order, of the method represented by
-     * this {@code Method} object. (Returns an array of length zero if the
-     * underlying method is parameterless.  If the method has one or more
-     * parameters, a nested array of length zero is returned for each parameter
-     * with no annotations.) The annotation objects contained in the returned
-     * arrays are serializable.  The caller of this method is free to modify
-     * the returned arrays; it will have no effect on the arrays returned to
-     * other callers.
-     *
-     * @return an array of arrays that represent the annotations on the formal
-     *    parameters, in declaration order, of the method represented by this
-     *    Method object
+     * {@inheritDoc}
+     * @throws NullPointerException  {@inheritDoc}
      * @since 1.5
      */
-    public Annotation[][] getParameterAnnotations() {
-        Annotation[][] parameterAnnotations = getParameterAnnotationsNative();
-        if (parameterAnnotations == null) {
-          parameterAnnotations = new Annotation[getParameterTypes().length][0];
-        }
-        return parameterAnnotations;
+    public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
+        return super.getAnnotation(annotationClass);
     }
-    private native Annotation[][] getParameterAnnotationsNative();
+
+    /**
+     * {@inheritDoc}
+     * @since 1.5
+     */
+    public Annotation[] getDeclaredAnnotations()  {
+        return super.getDeclaredAnnotations();
+    }
+
+    /**
+     * {@inheritDoc}
+     * @since 1.5
+     */
+    @Override
+    public Annotation[][] getParameterAnnotations() {
+        // Android-changed: This is handled by AbstractMethod.
+        return super.getParameterAnnotations();
+    }
 
     /**
      * Returns the constructor's signature in non-printable form. This is called
@@ -628,13 +515,6 @@
      * @hide needed by Proxy
      */
     boolean equalNameAndParameters(Method m) {
-        return getName().equals(m.getName()) && equalMethodParameters(m.getParameterTypes());
-    }
-
-    /**
-     * Returns {@code true} if this method is a default method; returns {@code false} otherwise.
-     */
-    public boolean isDefault() {
-      return super.isDefault();
+        return equalNameAndParametersInternal(m);
     }
 }
diff --git a/ojluni/src/main/java/java/lang/reflect/Modifier.java b/ojluni/src/main/java/java/lang/reflect/Modifier.java
index 78e0dbc..f461be5 100644
--- a/ojluni/src/main/java/java/lang/reflect/Modifier.java
+++ b/ojluni/src/main/java/java/lang/reflect/Modifier.java
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -398,6 +398,12 @@
         Modifier.VOLATILE;
 
     /**
+     *
+     */
+    static final int ACCESS_MODIFIERS =
+        Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
+
+    /**
      * Return an {@code int} value OR-ing together the source language
      * modifiers that can be applied to a class.
      * @return an {@code int} value OR-ing together the source language
diff --git a/ojluni/src/main/java/java/lang/reflect/Type.java b/ojluni/src/main/java/java/lang/reflect/Type.java
index 76b40d6..fb98684 100644
--- a/ojluni/src/main/java/java/lang/reflect/Type.java
+++ b/ojluni/src/main/java/java/lang/reflect/Type.java
@@ -34,4 +34,17 @@
  */
 
 public interface Type {
+    /**
+     * Returns a string describing this type, including information
+     * about any type parameters.
+     *
+     * @implSpec The default implementation calls {@code toString}.
+     *
+     * @return a string describing this type
+     * @since 1.8
+     * @hide Pending tests
+     */
+    default String getTypeName() {
+        return toString();
+    }
 }
diff --git a/ojluni/src/main/java/java/nio/charset/Charset.java b/ojluni/src/main/java/java/nio/charset/Charset.java
old mode 100644
new mode 100755
index 24bc995..29cf26a
--- a/ojluni/src/main/java/java/nio/charset/Charset.java
+++ b/ojluni/src/main/java/java/nio/charset/Charset.java
@@ -210,10 +210,7 @@
  * input sequence are not omitted since the same code is used to represent
  * <small>ZERO-WIDTH NON-BREAKING SPACE</small>.
  *
- * <p> Every instance of the Java virtual machine has a default charset, which
- * may or may not be one of the standard charsets.  The default charset is
- * determined during virtual-machine startup and typically depends upon the
- * locale and charset being used by the underlying operating system. </p>
+ * <p>Android note: The Android platform default is always UTF-8.
  *
  * <p>The {@link StandardCharsets} class defines constants for each of the
  * standard charsets.
@@ -651,9 +648,7 @@
     /**
      * Returns the default charset of this Java virtual machine.
      *
-     * <p> The default charset is determined during virtual-machine startup and
-     * typically depends upon the locale and charset of the underlying
-     * operating system.
+     * <p>Android note: The Android platform default is always UTF-8.
      *
      * @return  A charset object for the default charset
      *
diff --git a/openjdk_java_files.mk b/openjdk_java_files.mk
index fe4ad2d..1238d5a 100644
--- a/openjdk_java_files.mk
+++ b/openjdk_java_files.mk
@@ -178,6 +178,7 @@
     ojluni/src/main/java/java/lang/reflect/Array.java \
     ojluni/src/main/java/java/lang/reflect/Constructor.java \
     ojluni/src/main/java/java/lang/reflect/Field.java \
+    ojluni/src/main/java/java/lang/reflect/Executable.java \
     ojluni/src/main/java/java/lang/reflect/GenericArrayType.java \
     ojluni/src/main/java/java/lang/reflect/GenericDeclaration.java \
     ojluni/src/main/java/java/lang/reflect/GenericSignatureFormatError.java \