blob: 2f8526d2fc40ce55659709e0a3288b22b7810a2c [file] [log] [blame]
Vladimir Marko5437e6f2020-09-02 12:03:14 +01001/*
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
17package resolved;
18
19import getters.GetPackagePrivateSubclassOfUnresolvedClass;
20import unresolved.UnresolvedPublicClass;
21
22class PackagePrivateSubclassOfUnresolvedClass extends UnresolvedPublicClass {
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)
Vladimir Marko270e10a2020-09-24 11:48:47 +010032 /// CHECK: LoadClass class_name:resolved.PackagePrivateSubclassOfUnresolvedClass needs_access_check:false
Vladimir Marko5437e6f2020-09-02 12:03:14 +010033 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
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
49 static void $noinline$testInlinedReferrersClassFromSamePackage() {
Vladimir Marko270e10a2020-09-24 11:48:47 +010050 // TODO: Make $inline$ and enable CHECK above when we relax the verifier. b/28313047
Vladimir Marko5437e6f2020-09-02 12:03:14 +010051 Class<?> c = GetPackagePrivateSubclassOfUnresolvedClassFromSamePackage.get();
52 }
53}