Mathieu Chartier | 091d238 | 2015-03-06 10:59:06 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | public class Main { |
| 18 | // Enough to trigger JIT. |
| 19 | static final int loopIterations = 5000; |
| 20 | static int counter = 0; |
| 21 | |
| 22 | static interface TheInterface { |
| 23 | public void m(); |
| 24 | } |
| 25 | |
| 26 | static abstract class AbstractClass implements TheInterface { |
| 27 | } |
| 28 | |
| 29 | static class ConcreteClass extends AbstractClass { |
| 30 | public void m() { |
| 31 | ++counter; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | static void doStuff(AbstractClass c) { |
| 36 | for (int i = 0; i < loopIterations; ++i) { |
| 37 | c.m(); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | public static void main(String[] args) throws Exception { |
| 42 | ConcreteClass o = new ConcreteClass(); |
| 43 | for (int i = 0; i < loopIterations; ++i) { |
| 44 | doStuff(o); |
| 45 | } |
| 46 | if (counter != loopIterations * loopIterations) { |
| 47 | System.out.println("Expected " + loopIterations * loopIterations + " got " + counter); |
| 48 | } |
Andreas Gampe | d9e2301 | 2015-06-04 22:19:58 -0700 | [diff] [blame^] | 49 | |
| 50 | try { |
| 51 | Class<?> b21646347 = Class.forName("B21646347"); |
| 52 | throw new RuntimeException("Expected a VerifyError"); |
| 53 | } catch (VerifyError expected) { |
| 54 | System.out.println("b/21646347"); |
| 55 | } catch (Throwable t) { |
| 56 | t.printStackTrace(); |
| 57 | } |
Mathieu Chartier | 091d238 | 2015-03-06 10:59:06 -0800 | [diff] [blame] | 58 | System.out.println("Finishing"); |
| 59 | } |
| 60 | } |