blob: 370185a4d92196b66ceb5b3515f1ec8696dc3150 [file] [log] [blame]
Andreas Gampeaa8b60c2016-10-12 12:51:25 -07001/*
2 * Copyright (C) 2016 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
17import java.util.Arrays;
18import java.util.Collections;
19import java.util.HashSet;
20
21public class Main {
22 public static void main(String[] args) throws Exception {
Andreas Gampeaa8b60c2016-10-12 12:51:25 -070023 doTest();
24 }
25
26 public static void doTest() throws Exception {
27 // Ensure some classes are loaded.
28 A a = new A();
29 B b = new B();
30 A[] aArray = new A[5];
31
32 String[] classes = getLoadedClasses();
33 HashSet<String> classesSet = new HashSet<>(Arrays.asList(classes));
34
35 String[] shouldBeLoaded = new String[] {
36 "java.lang.Object", "java.lang.Class", "java.lang.String", "Main$A", "Main$B", "[LMain$A;"
37 };
38
39 boolean error = false;
40 for (String s : shouldBeLoaded) {
41 if (!classesSet.contains(s)) {
42 System.out.println("Did not find " + s);
43 error = true;
44 }
45 }
46
47 if (error) {
48 System.out.println(Arrays.toString(classes));
49 }
50 }
51
52 static class A {
53 }
54
55 static class B {
56 }
57
58 private static native String[] getLoadedClasses();
59}