1efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil/*
2efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * Copyright (C) 2015 The Android Open Source Project
3efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil *
4efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * Licensed under the Apache License, Version 2.0 (the "License");
5efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * you may not use this file except in compliance with the License.
6efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * You may obtain a copy of the License at
7efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil *
8efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil *      http://www.apache.org/licenses/LICENSE-2.0
9efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil *
10efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * Unless required by applicable law or agreed to in writing, software
11efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * distributed under the License is distributed on an "AS IS" BASIS,
12efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * See the License for the specific language governing permissions and
14efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil * limitations under the License.
15efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil */
16efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil
17efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdilimport java.lang.reflect.*;
18efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil
19efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdilpublic class Main {
20efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil
21efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil  // Workaround for b/18051191.
22efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil  class InnerClass {}
23efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil
24efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil  public static void main(String[] args) throws Throwable {
25efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil    try {
26efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil      Class<?> c = Class.forName("TestCase");
27efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil      Method m = c.getMethod("foo");
28efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil      m.invoke(null, (Object[]) null);
29efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil    } catch (InvocationTargetException ex) {
30efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil      // Code should have thrown AIOOB.
31efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil      if (!(ex.getCause() instanceof ArrayIndexOutOfBoundsException)) {
32efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil        throw ex;
33efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil      }
34efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil    }
35efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil  }
36efc3f02504e8e3768cc18ab5347c5a6d19d6a935David Brazdil}
37