• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 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.
9 public class Main {
10   public interface DataI {
field()11     int field();
12   }
13   public static class Data implements DataI {
14     final int a;
equals(Object other)15     public boolean equals(Object other) {
16       if (other instanceof DataI) {
17         return a == ((DataI) other).field();
18       }
19       return false;
20     }
Data(int a)21     Data(int a) {
22       this.a = a;
23     }
field()24     public int field() {
25       return a;
26     }
27   }
main(String[] args)28   public static void main (String[] args) {
29     System.out.print(new Data(1).equals(new Data(1)));
30   }
31 }
32