You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Christian Appl (Jira)" <ji...@apache.org> on 2020/07/27 18:06:00 UTC

[jira] [Comment Edited] (PDFBOX-4723) Add equals() and hashCode() to PDAnnotation and COS objects

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

Christian Appl edited comment on PDFBOX-4723 at 7/27/20, 6:05 PM:
------------------------------------------------------------------

Indeed. My whole point is: This will most likely cause issues and incompatibilities with solutions, that are using and are based on PDFbox. I would prefer a solution that must be selected intentionally and therefore does not influence the operation of applications based on PDFBox. I am aware that equality and identity are not the same concept. I can see your argument. But however: Some implementations rely on equals() to test for identity - as this is an expectable behaviour most of the time.
 I would think of overriding such a method as some form of a last resort. I also can imagine why you would want to override equals() - you would want to do that, to influence the operation of Collections such as Lists and Maps, to order, select and filter content more easily.
 However - maybe such a functionality should not be forced upon the user of the library?


was (Author: capsvd):
Indeed. My whole point is: This will most likely cause issues and incompatibilities with solutions, that are using and are based on PDFbox. I would prefer a solution that must be selected intentionally and therefore does not influence the operation of applications based on PDFBox. I am aware that equality and identity are not the same concept. I can see your argument. But however: Some implementations rely on equals() to test for identity - as this is an expectable behaviour most of the time.
I would think of overriding such a method as some form of a last resort. I also can imagine why you would want to override equals() - you would want to do that, to influence the operation of Collections such as Lists and Maps, to order, select and filter content more easily.
However - maybe such a functionality should not be passed on to the user of the library?

> 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: 3.0.0 PDFBox
>
>         Attachments: bird_burst.heic.pdf, screenshot-1.png
>
>
> 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-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org