blob: 6e511a0f086e0e63e37717428657396e42c1a124 [file] [log] [blame]
clementbera72885972019-05-21 12:30:02 +02001// 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
clementberabe19d302019-05-23 17:23:21 +02005package nesthostexample;
clementbera948e4182019-05-14 12:25:26 +02006
7public class BasicNestHostClassMerging {
8
9 private String field = "Outer";
10
11 public static class MiddleOuter extends BasicNestHostClassMerging {
12
13 private String field = "Middle";
14
15 public static void main(String[] args) {
16 System.out.println(new InnerMost().getFields());
17 }
18 }
19
20 public static class MiddleInner extends MiddleOuter {
21 private String field = "Inner";
22 }
23
24 public static class InnerMost extends MiddleInner {
25
clementberad5bd4f32019-05-21 12:22:06 +020026 @NeverInline
clementbera948e4182019-05-14 12:25:26 +020027 public String getFields() {
28 return ((BasicNestHostClassMerging) this).field
29 + ((MiddleOuter) this).field
30 + ((MiddleInner) this).field;
31 }
32 }
33
34 public static void main(String[] args) {
35 System.out.println(new InnerMost().getFields());
36 }
37}