[ https://issues.apache.org/jira/browse/PDFBOX-4723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17027595#comment-17027595 ]
Christian Appl commented on PDFBOX-4723: ---------------------------------------- I am a mere user of this library and as such, I can only ask you to rethink this implementation. Speaking only for myself: If this change is part of 2.0.19, I (aswell as all other users of the library) will have to check for all usages of equals in our application and will have to adapt it accordingly. This may not be an impossible task, but it is entirely avoidable. As this is a standard method, that can be expected to behave in a certain, specific way I am certain, that we (and other users of the library) definately have used it. I am also worried about the sheer number of possible bugs and other issues that might result from this change (in PDFBox itself and all applications based on the library). This behaviour of equals is unexpected (atleast from my point of view it is) and I definately did not suspect this method to have changed, when I had a first superficial look into the issue on our end. I don't know if I can agree to what you said about the equals method. The Oracle Javadoc is describing the intended purpose of equals as: {quote}The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true).{quote} (according to [#https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)]) You can certainly override, redefine and replace it, but I would really prefer, if you wouldn't. > 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