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

Maruan Sahyoun commented on PDFBOX-4723:
----------------------------------------

IMHO the new implementation is inline with the regulrar List behaviour but 
there are issues which are outlines above by [~mkl] as well as one could access 
the COSArray directly and shuflle the items around, apply Collections.rotate() 
... all of which would make PD and COS get out of sync.

E.g. for annotations, instead of dealing with the COSArrayList one could
- create a list of annotations in PD
- work with these
- finally use {{setAnnotations(List<PDAnnotation> annotations)}}

Or (even better but more changes needed in current code) - the COSArray is 
created when saving the PDF.

Based on the discussion we should either go with the changes or revert keeping 
in mind that one should use COSArrayList only for reading or adding or updating 
single items through PD but not doing remove or other operations affecting the 
order of items. This would also mean that the main iterator issue can not or 
only partly be implemented. 

> Add equals() and hashCode() to PDAnnotation and COS objects
> -----------------------------------------------------------
>
>                 Key: PDFBOX-4723
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4723
>             Project: PDFBox
>          Issue Type: Sub-task
>          Components: PDModel
>    Affects Versions: 2.0.18
>            Reporter: Maruan Sahyoun
>            Assignee: Maruan Sahyoun
>            Priority: Major
>             Fix For: 2.0.19, 3.0.0 PDFBox
>
>
> In order to proper support removeAll/retainAll for COSArrayList we need to 
> detect if entries are in fact duplicates of others. This currently fails as 
> even though one might add the same instance of an annotation object multiple 
> times to setAnnotations getting the annotations will have individual 
> instances. See the discussion at PDFBOX-4669.
> In order to proper support removal we need to be able to detect equality 
> where an object is equal if the underlying COSDictionary has the same entries.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to