Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8281291

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

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8, 19
    • 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;
          }

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

              Created:
              Updated: