[ https://issues.apache.org/jira/browse/PDFBOX-4723?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17027531#comment-17027531 ]
Christian Appl commented on PDFBOX-4723: ---------------------------------------- Testing the current Snapshot we encountered a problem with this solution. In one of our tests we are checking the correct page order of a document, when adding pages to a document. The test ended up adding the pages after the second page instead of the fifth. (as the contents of page 2 and 5 of said document seem to be identical) One can easily reproduce this by inserting pages via PDPageTree.insertBefore(...) / PDPageTree.insertAfter(...) (which is using equals: _if (pageDict.equals(nextPage.getCOSObject()))_) In my opinion content equality is not a sufficient criterium to deduce identity. The thought of having a ready to use method to check content equality is nice and I can understand the benefit of implementing it, but is it really necessary to override "equals" to reach that goal? I would prefer if the equals method would remain untouched and a new "contentEquals" (or the like) method was created instead. > 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