• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package art;
18 
19 import java.util.Arrays;
20 import java.util.Collections;
21 import java.util.HashSet;
22 
23 public class Test907 {
run()24   public static void run() throws Exception {
25     doTest();
26   }
27 
doTest()28   public static void doTest() throws Exception {
29     // Ensure some classes are loaded.
30     A a = new A();
31     B b = new B();
32     A[] aArray = new A[5];
33 
34     String[] classes = getLoadedClasses();
35     HashSet<String> classesSet = new HashSet<>(Arrays.asList(classes));
36 
37     String[] shouldBeLoaded = new String[] {
38         "java.lang.Object", "java.lang.Class", "java.lang.String", "art.Test907$A",
39         "art.Test907$B", "[Lart.Test907$A;"
40     };
41 
42     boolean error = false;
43     for (String s : shouldBeLoaded) {
44       if (!classesSet.contains(s)) {
45         System.out.println("Did not find " + s);
46         error = true;
47       }
48     }
49 
50     if (error) {
51       System.out.println(Arrays.toString(classes));
52     }
53   }
54 
55   static class A {
56   }
57 
58   static class B {
59   }
60 
getLoadedClasses()61   private static native String[] getLoadedClasses();
62 }
63