(String name, String desc, boolean toInterface)
| 639 | } |
| 640 | |
| 641 | public MethodInstance resolveMethod(String name, String desc, boolean toInterface) { |
| 642 | // toInterface = false: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.4.3.3 |
| 643 | // toInterface = true: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html#jvms-5.4.3.4 |
| 644 | // TODO: access check after resolution |
| 645 | |
| 646 | assert asmNodes == null || isInterface() == toInterface; |
| 647 | |
| 648 | if (!toInterface) { |
| 649 | MethodInstance ret = resolveSignaturePolymorphicMethod(name); |
| 650 | if (ret != null) return ret; |
| 651 | |
| 652 | ret = getMethod(name, desc); |
| 653 | if (ret != null) return ret; // <this> is unconditional |
| 654 | |
| 655 | ClassInstance cls = this; |
| 656 | |
| 657 | while ((cls = cls.superClass) != null) { |
| 658 | ret = cls.resolveSignaturePolymorphicMethod(name); |
| 659 | if (ret != null) return ret; |
| 660 | |
| 661 | ret = cls.getMethod(name, desc); |
| 662 | if (ret != null) return ret; |
| 663 | } |
| 664 | |
| 665 | return resolveInterfaceMethod(name, desc); |
| 666 | } else { |
| 667 | MethodInstance ret = getMethod(name, desc); |
| 668 | if (ret != null) return ret; // <this> is unconditional |
| 669 | |
| 670 | if (superClass != null) { |
| 671 | assert superClass.id.equals("Ljava/lang/Object;"); |
| 672 | |
| 673 | ret = superClass.getMethod(name, desc); |
| 674 | if (ret != null && (!ret.isReal() || (ret.access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC)) == Opcodes.ACC_PUBLIC)) return ret; |
| 675 | } |
| 676 | |
| 677 | return resolveInterfaceMethod(name, desc); |
| 678 | } |
| 679 | } |
| 680 | |
| 681 | private MethodInstance resolveSignaturePolymorphicMethod(String name) { |
| 682 | if (id.equals("Ljava/lang/invoke/MethodHandle;")) { // check for signature polymorphic method - jvms-2.9 |
no test coverage detected