Aaron Stewart created PDFBOX-1390:
-------------------------------------

             Summary: Is COSNumber mutable or immutable?
                 Key: PDFBOX-1390
                 URL: https://issues.apache.org/jira/browse/PDFBOX-1390
             Project: PDFBox
          Issue Type: Bug
          Components: PDModel
    Affects Versions: 1.7.0
            Reporter: Aaron Stewart
            Priority: Minor


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());


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to