[
https://issues.apache.org/jira/browse/PDFBOX-1390?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andreas Lehmkühler closed PDFBOX-1390.
--------------------------------------
Resolution: Not a Problem
Fix Version/s: (was: 2.0.0)
Assignee: Andreas Lehmkühler
COSNumber is mutable and yes, there is some chaching for lower numbers which
are often used.
Please use our [mailing lists|http://pdfbox.apache.org/mailinglists.html] for
such queries as JIRA is used for bug tracking only.
> 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
> Assignee: Andreas Lehmkühler
> Priority: Minor
> Labels: COS
> 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.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]