[ 
https://issues.apache.org/jira/browse/PDFBOX-2685?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14323786#comment-14323786
 ] 

Maruan Sahyoun commented on PDFBOX-2685:
----------------------------------------

So let's leave it at the current stage and postpone the issue to 2.1. The only 
drawback with that is - as we will very likely remove setDirect() from COSBase 
- this will break the API. As I think that this is only used internally anyway 
it wouldn't affect the user but API breaking changes would normally require a 
major release.

>From a COSWriter perspective - yes it's very generic which is good but in that 
>case part of the issue. There are only a small number of structures in PDF 
>which do require that an object has to be direct or indirect e.g. the cross 
>reference stream dictionary has some.

What we could do is add some JavaDoc to the methods stating that these are 
'internal use' only due to be removed without further notice and deprecate the 
methods so people will get them flagged in their IDE (if they care to check 
:-)).

> COS 'primitive' types are mutable
> ---------------------------------
>
>                 Key: PDFBOX-2685
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2685
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 1.8.8, 1.8.9, 2.0.0
>            Reporter: Tilman Hausherr
>            Assignee: Maruan Sahyoun
>             Fix For: 2.0.0
>
>
> From [~torakiki]:
> They are cached and they are mutable so this:
> {code}
>         COSInteger cosint = COSInteger.get(10);
>         cosint.setValue(50);
>         //lets move to a totally unrelated part of my software
>         System.out.println(COSInteger.get(10));
> {code}
> prints COSInteger(50) so basically I ask for a 10 and get a 50, isn't it 
> weird (and error prone)? ... or the way around, I call cosint.setValue(50) at 
> some point in the software and that makes it a 50 everywhere I used 
> COSInteger.get(10).
> That's of course also true for the other mutable attributes setDirect and 
> setNeedToBeUpdate.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to