You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2020/08/23 08:43:17 UTC

[GitHub] [commons-collections] TobiasKiecker commented on pull request #176: changed misleading typo in ListIteratorWrapper.java

TobiasKiecker commented on pull request #176:
URL: https://github.com/apache/commons-collections/pull/176#issuecomment-678747096


   I just think that there is obviously something wrong with this javadoc.
   
   First, the text states : "Throws UnsupportedOperationException if previous() has ever been called."
   while the Throws tag is : "Throws: UnsupportedOperationException - always"
   that is already contradicting
   
   Actually it throws IllegalStateException if previous() (or next()) has not been called before.
   So it behaves like remove() from the interface "ListIterator" it implements: https://docs.oracle.com/javase/7/docs/api/java/util/ListIterator.html#remove()
   
   The already existing test class: "commons.collections4.iterators.ListIteratorWrapperTest.java"
   also proves that the current doc is wrong because it includes a case of calling remove() after previous() has been called, error free.
   https://github.com/apache/commons-collections/blob/ac61e06bc174b3571364278feef3a6973d98d0c3/src/test/java/org/apache/commons/collections4/iterators/ListIteratorWrapperTest.java#L159-L168
   
   So I am not sure what would be best here but I think, as it is right now, it is wrong and misleading.
   
   I could write a new commit changing this javadoc completly, if desired.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org