clementbera | 7288597 | 2019-05-21 12:30:02 +0200 | [diff] [blame] | 1 | // Copyright (c) 2019, the R8 project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
clementbera | be19d30 | 2019-05-23 17:23:21 +0200 | [diff] [blame] | 5 | package nesthostexample; |
clementbera | d5bd4f3 | 2019-05-21 12:22:06 +0200 | [diff] [blame] | 6 | |
| 7 | public class NestHostInlining { |
| 8 | |
| 9 | private String field = "inlining"; |
| 10 | |
| 11 | public static class InnerWithPrivAccess { |
| 12 | public String access(NestHostInlining host) { |
| 13 | return host.field; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | public static class InnerNoPrivAccess { |
| 18 | public String print() { |
| 19 | return "InnerNoPrivAccess"; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | public abstract static class EmptyNoPrivAccess {} |
| 24 | |
| 25 | public abstract static class EmptyWithPrivAccess { |
| 26 | public String access(NestHostInlining host) { |
| 27 | return host.field; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | public static void main(String[] args) { |
| 32 | System.out.println(new InnerWithPrivAccess().access(new NestHostInlining())); |
| 33 | System.out.println(new InnerNoPrivAccess().print()); |
| 34 | } |
| 35 | } |