Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-1836

[PATCH] Bring clone() in line with the recommendations in Object.clone()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 2.5
    • None
    • unqualified
    • None
    • Operating System: All
      Platform: All
    • 49754

    Description

      This patch tries to fix the problems with the clone method as reported by findbugs.

      The fix is not straightforward. The current design deviates from the design advocated by findbugs and the documentation of Object.clone(). It is sometimes hard to guess the author's intention with the original clone method. Often the clone is not completely deep; was this intentional or not? This patch makes almost always deep copies, esp. in the subclasses of AreaTreeObject. This patch passes all existing junit tests. Since findbugs requires more memory than my machine has, I could not check if this patch removes all findbugs warnings for clone.

      How does clone differ from a copy constructor? Is it a bad situation to have both a clone method and a copy constructor? Is it advisable to delete one of them?

      Because it is not straightforward, I submit this as a patch, instead of committing it right away.

      Attachments

        1. diff.txt.gz
          6 kB
          Simon Pepping

        Activity

          People

            fop-dev@xmlgraphics.apache.org fop-dev
            spepping Simon Pepping
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: