Fop
  1. Fop
  2. FOP-1836

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

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: trunk
    • Fix Version/s: None
    • Component/s: general
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All
    • External issue ID:
      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.

      1. diff.txt.gz
        6 kB
        Simon Pepping

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            fop-dev
            Reporter:
            Simon Pepping
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development