[
https://issues.apache.org/jira/browse/PDFBOX-4723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17008969#comment-17008969
]
Michael Klink commented on PDFBOX-4723:
---------------------------------------
{quote}Not sure I got your point about removeAl - if I'm not mistaken it works
similar to a standard removeAll for a List. i.e. if there is a list entry with
3 identical objects and you call removeAll with one of the objetcs in the
Collection argument all entries are gone.
{quote}
Yes and no...
The question is what the user will expect _identical_ to mean. Are two indirect
references to distinct indirect objects which happen to have the same contents
_identical_?
One can surely argue that they are because they are equivalent as COS objects.
On the other hand there is a difference, e.g. Acrobat does not like multiple
references to the same indirect object in the page tree (or at least used to
not like, I haven't checked recently). On the other hand two references to
distinct indirect page objects works flawlessly, even if their contents are
identical. Similarly, according to the PDF specification the same indirect
annotation object must not be referenced from Annots arrays of different pages
but distinct annotation objects with identical content may.
Thus, already in the context of the PDF specification sometimes _identical_
means something else than _equivalent_ on the COS level.
Similarly there will be numerous situations a PDFBox user won't consider PDF
objects identical even though they may be equivalent on the COS level.
That essentially is the background of my comment above.
(Maybe, though, I'm simply overestimating the impact of the changes... ;) )
> 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: [email protected]
For additional commands, e-mail: [email protected]