Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-235

OptionBuilder wrong design

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Component/s: Options definition
    • Labels:

      Description

      OptionBuilder uses static variables to do its work. That's why it is not thread safe.

      More than that, static builder methods doesn't conform to Java good style of accessing static members. Such members belong to the class and must be accessed in static way.

      Consider creating new builder-like class like that:

      OptionBuilder optionBuilder = OptionBuilder.newInstance();
      options.add(optionBuilder.withDescription().hasArg().create());
      options.add(optionBuilder.withDescription().hasArg().create());
      options.add(optionBuilder.withDescription().hasArg().create());
      

        Attachments

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sergey-b Sergey B.

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment