Stephan Herhut | 7fa3d1b | 2017-08-04 13:30:15 +0200 | [diff] [blame] | 1 | // Copyright (c) 2017, 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 | package inlining; |
| 5 | |
| 6 | public class InlineConstructorFinalField { |
| 7 | |
| 8 | public final int number; |
| 9 | |
| 10 | @CheckDiscarded |
| 11 | InlineConstructorFinalField(int value) { |
| 12 | number = value; |
| 13 | } |
| 14 | |
| 15 | // This will not be inlined, as it sets a final field. |
| 16 | InlineConstructorFinalField() { |
| 17 | this(42); |
| 18 | } |
| 19 | |
| 20 | public String toString() { |
| 21 | return "value: " + number; |
| 22 | } |
| 23 | } |