code: private static <T> boolean matches(T tool, String moduleName) {
          PrivilegedAction<Boolean> pa = () -> {
              // for now, use reflection to implement
              //      return moduleName.equals(tool.getClass().getModule().getName());
              try {
                  Method getModuleMethod = Class.class.getDeclaredMethod("getModule");
                  Object toolModule = getModuleMethod.invoke(tool.getClass());
                  Method getNameMethod = toolModule.getClass().getDeclaredMethod("getName");
                  String toolModuleName = (String) getNameMethod.invoke(toolModule);
                  return moduleName.equals(toolModuleName);
              } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
                  return false;
              }
          };
          return AccessController.doPrivileged(pa);
      }
docs: Determine if this is the desired tool instance.
  @param <T>        the interface of the tool
  @param tool       the instance of the tool
  @param moduleName the name of the module containing the desired implementation
  @return true if and only if the tool matches the specified criteria