blob: 0489ca47a320a6d5f01325eef634ac54e13ea8c5 [file] [log] [blame]
Jinseong Jeonefa78e12017-10-16 15:04:24 -07001// 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 adaptclassstrings;
5
6public class Main {
7 public static void main(String[] args) throws Exception {
Tamas Kenez6d1dad02019-02-19 10:14:01 +01008 assert false;
Jinseong Jeonefa78e12017-10-16 15:04:24 -07009 int f = 3;
10 A a = new A(f);
11 AA aa = new AA(f);
12 assert a.foo() != aa.foo();
13
14 a.bar();
15
16 Object a_foo =
17 Class.forName("adaptclassstrings.A").getMethod("foo").invoke(a);
18 Object aa_foo =
19 Class.forName("adaptclassstrings.AA").getMethod("foo").invoke(aa);
20 assert !a_foo.equals(aa_foo);
21
22 Object c_to_a_foo =
23 Class.forName((String)
24 Class.forName("adaptclassstrings.C").getField("OTHER").get(null))
25 .getMethod("foo").invoke(a);
26 assert a_foo.equals(c_to_a_foo);
27
28 String cName = (String) Class.forName(C.ITSELF).getField("ITSELF").get(null);
Tamas Kenez6d1dad02019-02-19 10:14:01 +010029 boolean b = cName.equals(A.OTHER);
30 assert b;
Jinseong Jeonefa78e12017-10-16 15:04:24 -070031 }
32}