JDI should add com.sun.jdi.InterfaceType.concreteMethodByName() method

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8, 19
    • Component/s: core-svc
    • None

      There is a ClassType.concreteMethodByName() method, but no InterfaceType.concreteMethodByName(). I suspect this is because JDI was designed before JDK 8, which is when support for interfaces having static (and default) methods was added. It would be convenient for developers if this method was added to InterfaceType. Note no JDWP changes are needed for this. It's all implemented within the JDI implementation. I think the ClassType version will work as-is for InterfaceType:

          public Method concreteMethodByName(String name, String signature) {
              Method method = null;
              for (Method candidate : visibleMethods()) {
                  if (candidate.name().equals(name) &&
                      candidate.signature().equals(signature) &&
                      !candidate.isAbstract()) {

                      method = candidate;
                      break;
                  }
              }
              return method;
          }

            Assignee:
            Unassigned
            Reporter:
            Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: