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

[cli] clone method in Option should use super.clone()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • CLI-1.x
    • None
    • Operating System: other
      Platform: Other

    • 29908

    Description

      In
      org.apache.commons.cli.Option
      public method clone is implemented by creating a new instance through one of
      the class Constructors, and then assigning values as required through the
      setter methods.

      This means that any subclasses of the Option class will not return a true
      clone, but a new Option instance instead.

      A proper implementation of clone should use super.clone() to create a new
      instance, rather than calling the class constructor. This allows shallows
      clones to propogate correctly down to subclasses.

      Attachments

        1. CLI-21.patch
          0.8 kB
          Henri Yandell
        2. bug21.patch
          3 kB
          Brian Egge

        Activity

          People

            Unassigned Unassigned
            nathan.mcdonald@optusnet.com.au Nathan McDonald
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: