12ef645ba50544b879a82ea30e606f18c9af98917David Brazdil/*
22ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * Copyright (C) 2015 The Android Open Source Project
32ef645ba50544b879a82ea30e606f18c9af98917David Brazdil *
42ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * Licensed under the Apache License, Version 2.0 (the "License");
52ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * you may not use this file except in compliance with the License.
62ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * You may obtain a copy of the License at
72ef645ba50544b879a82ea30e606f18c9af98917David Brazdil *
82ef645ba50544b879a82ea30e606f18c9af98917David Brazdil *      http://www.apache.org/licenses/LICENSE-2.0
92ef645ba50544b879a82ea30e606f18c9af98917David Brazdil *
102ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * Unless required by applicable law or agreed to in writing, software
112ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * distributed under the License is distributed on an "AS IS" BASIS,
122ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * See the License for the specific language governing permissions and
142ef645ba50544b879a82ea30e606f18c9af98917David Brazdil * limitations under the License.
152ef645ba50544b879a82ea30e606f18c9af98917David Brazdil */
162ef645ba50544b879a82ea30e606f18c9af98917David Brazdil
172ef645ba50544b879a82ea30e606f18c9af98917David Brazdilimport java.lang.reflect.Method;
182ef645ba50544b879a82ea30e606f18c9af98917David Brazdilimport java.lang.reflect.Type;
192ef645ba50544b879a82ea30e606f18c9af98917David Brazdil
202ef645ba50544b879a82ea30e606f18c9af98917David Brazdilpublic class Main {
212ef645ba50544b879a82ea30e606f18c9af98917David Brazdil
222ef645ba50544b879a82ea30e606f18c9af98917David Brazdil  // Workaround for b/18051191.
232ef645ba50544b879a82ea30e606f18c9af98917David Brazdil  class InnerClass {}
242ef645ba50544b879a82ea30e606f18c9af98917David Brazdil
252ef645ba50544b879a82ea30e606f18c9af98917David Brazdil  public static void main(String args[]) throws Exception {
262ef645ba50544b879a82ea30e606f18c9af98917David Brazdil    Class<?> c = Class.forName("Test");
27166aaee6aa39c20c87113b3fcf0dcd81e0a934cbAndreas Gampe    Method m = c.getMethod("EmptyPackedSwitch", int.class);
282ef645ba50544b879a82ea30e606f18c9af98917David Brazdil    Integer result = (Integer) m.invoke(null, new Integer(42));
292ef645ba50544b879a82ea30e606f18c9af98917David Brazdil    if (result != 5) {
302ef645ba50544b879a82ea30e606f18c9af98917David Brazdil      throw new Error("Expected 5, got " + result);
312ef645ba50544b879a82ea30e606f18c9af98917David Brazdil    }
32166aaee6aa39c20c87113b3fcf0dcd81e0a934cbAndreas Gampe    m = c.getMethod("PackedSwitchAfterData", int.class);
335733e98d4889b7a94e4e647fa4033239038e07e8Vladimir Marko    result = (Integer) m.invoke(null, new Integer(0));
345733e98d4889b7a94e4e647fa4033239038e07e8Vladimir Marko    if (result != 1) {
355733e98d4889b7a94e4e647fa4033239038e07e8Vladimir Marko      throw new Error("Expected 1, got " + result);
365733e98d4889b7a94e4e647fa4033239038e07e8Vladimir Marko    }
372ef645ba50544b879a82ea30e606f18c9af98917David Brazdil  }
382ef645ba50544b879a82ea30e606f18c9af98917David Brazdil}
39