blob: 865fa1402357a36845acb3f3c599343a3021b67e [file] [log] [blame]
Lars Bak82e83bf2017-05-22 11:11:42 +02001// 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.
4package interfaceinlining;
5
6// This test ensures a check cast instruction is inserted IFF
7// the expression "((DataI) other).field()" is inlined.
8// Failing to do so will result in an ART verification error.
9public class Main {
10 public interface DataI {
11 int field();
12 }
13 public static class Data implements DataI {
14 final int a;
15 public boolean equals(Object other) {
16 if (other instanceof DataI) {
17 return a == ((DataI) other).field();
18 }
19 return false;
20 }
21 Data(int a) {
22 this.a = a;
23 }
24 public int field() {
25 return a;
26 }
27 }
28 public static void main (String[] args) {
29 System.out.print(new Data(1).equals(new Data(1)));
30 }
31}