141844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray/* 241844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * Copyright (C) 2015 The Android Open Source Project 341844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * 441844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License"); 541844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * you may not use this file except in compliance with the License. 641844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * You may obtain a copy of the License at 741844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * 841844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * http://www.apache.org/licenses/LICENSE-2.0 941844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * 1041844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software 1141844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS, 1241844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1341844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * See the License for the specific language governing permissions and 1441844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray * limitations under the License. 1541844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray */ 1641844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray 1741844e5071b2540d7b974ba09859170af2720776Nicolas Geoffrayimport java.lang.reflect.Method; 1841844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray 1941844e5071b2540d7b974ba09859170af2720776Nicolas Geoffraypublic class Main { 2041844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray 2141844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray // Workaround for b/18051191. 2241844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray class InnerClass {} 2341844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray 2441844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray static void assertEquals(int expected, int value) { 2541844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray if (expected != value) { 2641844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray throw new Error("Expected " + expected + ", got " + value); 2741844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray } 2841844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray } 2941844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray 3041844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray public static void main(String[] args) throws Exception { 3141844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray Class<?> c = Class.forName("InvokeSuper"); 3241844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray Method m = c.getMethod("run"); 3341844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray assertEquals(42, ((Integer)m.invoke(c.newInstance(), new Object[0])).intValue()); 3441844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray } 3541844e5071b2540d7b974ba09859170af2720776Nicolas Geoffray} 36