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 class AccessPublicMethodFromParent { foo(Integer i)34 public void foo(Integer i) { 35 i.notify(); 36 } 37 } 38 39 class AccessPublicStaticMethod { foo()40 public Integer foo() { 41 return Integer.getInteger("1"); 42 } 43 } 44 45 class AccessPublicStaticField { foo()46 public int foo() { 47 return Integer.BYTES; 48 } 49 } 50 51 /** 52 * Check that the classes using non publicly listed APIS are not verified. 53 */ 54 55 class AccessNonPublicCtor { foo()56 public Integer foo() { 57 return new Integer("1"); 58 } 59 } 60 61 class AccessNonPublicMethod { foo(Integer i)62 public float foo(Integer i) { 63 return i.floatValue(); 64 } 65 } 66 67 class AccessNonPublicMethodFromParent { foo(Integer i)68 public void foo(Integer i) { 69 i.notifyAll(); 70 } 71 } 72 73 class AccessNonPublicStaticMethod { foo()74 public Integer foo() { 75 return Integer.getInteger("1", 0); 76 } 77 } 78 79 class AccessNonPublicStaticField { foo()80 public Class foo() { 81 return Integer.TYPE; 82 } 83 } 84