[ 
https://issues.apache.org/jira/browse/PDFBOX-1390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Hewson updated PDFBOX-1390:
--------------------------------

    Fix Version/s: 2.0.0

> 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
>              Labels: COS
>             Fix For: 2.0.0
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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 was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to