Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-1390

Is COSNumber mutable or immutable?

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 1.7.0
    • None
    • PDModel

    Description

      I'm writing code to clone a PDPage as a deep copy. I'm trying to decide which objects are mutable and which are immutable.

      COSInteger is confusing. It has a factory method, which suggests there is some internal caching going on, but it also has a setValue() method. Caching makes sense for immutable objects. If it is caching values, then setValue() should probably be deprecated or removed.

      • * *

      Proposed JUnit code:

      COSInteger original = COSInteger.get(1);
      COSInteger copy = COSInteger.get(1);
      copy.setValue(5);
      assertEquals(1L, original.longValue());

      Attachments

        Activity

          People

            lehmi Andreas Lehmkühler
            aaronstewart Aaron Stewart
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified