blob: ada8cefeadf3e841ebc463969df485e59f3ad224 [file] [log] [blame]
Mathieu Chartier091d2382015-03-06 10:59:06 -08001/*
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
17public 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 Gamped9e23012015-06-04 22:19:58 -070049
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 Chartier091d2382015-03-06 10:59:06 -080058 System.out.println("Finishing");
59 }
60}