blob: ef6b4efab51e872d2c0f27866842444817459fe1 [file] [log] [blame]
Calin Juravle33787682019-07-26 14:27:18 -07001/*
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
21class AccessPublicCtor {
22 public Integer foo() {
23 return new Integer(1);
24 }
25}
26
27class AccessPublicMethod {
28 public double foo(Integer i) {
29 return i.doubleValue();
30 }
31}
32
Cole Faust4d8fea02022-10-15 21:33:27 -070033@SuppressWarnings("LockOnBoxedPrimitive")
Calin Juravle33787682019-07-26 14:27:18 -070034class AccessPublicMethodFromParent {
35 public void foo(Integer i) {
36 i.notify();
37 }
38}
39
40class AccessPublicStaticMethod {
41 public Integer foo() {
42 return Integer.getInteger("1");
43 }
44}
45
46class AccessPublicStaticField {
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
56class AccessNonPublicCtor {
57 public Integer foo() {
58 return new Integer("1");
59 }
60}
61
62class AccessNonPublicMethod {
63 public float foo(Integer i) {
64 return i.floatValue();
65 }
66}
67
Cole Faust4d8fea02022-10-15 21:33:27 -070068@SuppressWarnings("LockOnBoxedPrimitive")
Calin Juravle33787682019-07-26 14:27:18 -070069class AccessNonPublicMethodFromParent {
70 public void foo(Integer i) {
71 i.notifyAll();
72 }
73}
74
75class AccessNonPublicStaticMethod {
76 public Integer foo() {
77 return Integer.getInteger("1", 0);
78 }
79}
80
81class AccessNonPublicStaticField {
82 public Class foo() {
83 return Integer.TYPE;
84 }
85}