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

Templatize num_arguments() functions of DCmd subclasses

XMLWordPrintable

    • svc
    • b17

      We have many version of num_arguments for the DCmd subclasses. They all have identical structure. We should templatize them to reduce duplicated code and avoid cut-and-paste errors.

      Examples:

      int ThreadDumpDCmd::num_arguments() {
        ResourceMark rm;
        ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false);
        if (dcmd != NULL) {
          DCmdMark mark(dcmd);
          return dcmd->_dcmdparser.num_arguments();
        } else {
          return 0;
        }
      }

      int JMXStartRemoteDCmd::num_arguments() {
        ResourceMark rm;
        JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false);
        if (dcmd != NULL) {
          DCmdMark mark(dcmd);
          return dcmd->_dcmdparser.num_arguments();
        } else {
          return 0;
        }
      }

            iklam Ioi Lam
            iklam Ioi Lam
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: