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 package resolved; 18 19 import getters.GetPackagePrivateSubclassOfUnresolvedClass; 20 import unresolved.UnresolvedPublicClass; 21 22 class PackagePrivateSubclassOfUnresolvedClass extends UnresolvedPublicClass { $noinline$main()23 public static void $noinline$main() { 24 $noinline$testReferrersClass(); 25 $noinline$testInlinedReferrersClass(); 26 $noinline$testInlinedReferrersClassFromSamePackage(); 27 28 System.out.println("PackagePrivateSubclassOfUnresolvedClass passed"); 29 } 30 31 /// CHECK-START: void resolved.PackagePrivateSubclassOfUnresolvedClass.$noinline$testReferrersClass() builder (after) 32 /// CHECK: LoadClass class_name:resolved.PackagePrivateSubclassOfUnresolvedClass needs_access_check:false $noinline$testReferrersClass()33 static void $noinline$testReferrersClass() { 34 Class<?> c = PackagePrivateSubclassOfUnresolvedClass.class; 35 } 36 37 /// CHECK-START: void resolved.PackagePrivateSubclassOfUnresolvedClass.$noinline$testInlinedReferrersClass() inliner (after) 38 // CHECK: LoadClass class_name:resolved.PackagePrivateSubclassOfUnresolvedClass needs_access_check:true $noinline$testInlinedReferrersClass()39 static void $noinline$testInlinedReferrersClass() { 40 try { 41 // TODO: Make $inline$ and enable CHECK above when we relax the verifier. b/28313047 42 Class<?> c = GetPackagePrivateSubclassOfUnresolvedClass.get(); 43 throw new Error("Unreachable"); 44 } catch (IllegalAccessError expected) {} 45 } 46 47 /// CHECK-START: void resolved.PackagePrivateSubclassOfUnresolvedClass.$noinline$testInlinedReferrersClassFromSamePackage() inliner (after) 48 // CHECK: LoadClass class_name:resolved.PackagePrivateSubclassOfUnresolvedClass needs_access_check:false $noinline$testInlinedReferrersClassFromSamePackage()49 static void $noinline$testInlinedReferrersClassFromSamePackage() { 50 // TODO: Make $inline$ and enable CHECK above when we relax the verifier. b/28313047 51 Class<?> c = GetPackagePrivateSubclassOfUnresolvedClassFromSamePackage.get(); 52 } 53 } 54