Jinseong Jeon | efa78e1 | 2017-10-16 15:04:24 -0700 | [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 adaptclassstrings; |
| 5 | |
| 6 | public class Main { |
| 7 | public static void main(String[] args) throws Exception { |
Tamas Kenez | 6d1dad0 | 2019-02-19 10:14:01 +0100 | [diff] [blame] | 8 | assert false; |
Jinseong Jeon | efa78e1 | 2017-10-16 15:04:24 -0700 | [diff] [blame] | 9 | 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 Kenez | 6d1dad0 | 2019-02-19 10:14:01 +0100 | [diff] [blame] | 29 | boolean b = cName.equals(A.OTHER); |
| 30 | assert b; |
Jinseong Jeon | efa78e1 | 2017-10-16 15:04:24 -0700 | [diff] [blame] | 31 | } |
| 32 | } |