xref: /aosp_15_r20/art/test/Dex2oatVdexTestDex/Dex2oatVdexTestDex.java (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1 /*
2  * Copyright (C) 2020 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 /**
18  * Check that the classes using publicly listed APIS are verified.
19  */
20 
21 class AccessPublicCtor {
foo()22   public Integer foo() {
23     return new Integer(1);
24   }
25 }
26 
27 class AccessPublicMethod {
foo(Integer i)28   public double foo(Integer i) {
29     return i.doubleValue();
30   }
31 }
32 
33 @SuppressWarnings("LockOnBoxedPrimitive")
34 class AccessPublicMethodFromParent {
foo(Integer i)35   public void foo(Integer i) {
36     i.notify();
37   }
38 }
39 
40 class AccessPublicStaticMethod {
foo()41   public Integer foo() {
42     return Integer.getInteger("1");
43   }
44 }
45 
46 class AccessPublicStaticField {
foo()47   public int foo() {
48     return Integer.BYTES;
49   }
50 }
51 
52 /**
53  * Check that the classes using non publicly listed APIS are not verified.
54  */
55 
56 class AccessNonPublicCtor {
foo()57   public Integer foo() {
58     return new Integer("1");
59   }
60 }
61 
62 class AccessNonPublicMethod {
foo(Integer i)63   public float foo(Integer i) {
64     return i.floatValue();
65   }
66 }
67 
68 @SuppressWarnings("LockOnBoxedPrimitive")
69 class AccessNonPublicMethodFromParent {
foo(Integer i)70   public void foo(Integer i) {
71     i.notifyAll();
72   }
73 }
74 
75 class AccessNonPublicStaticMethod {
foo()76   public Integer foo() {
77     return Integer.getInteger("1", 0);
78   }
79 }
80 
81 class AccessNonPublicStaticField {
foo()82   public Class foo() {
83     return Integer.TYPE;
84   }
85 }
86