commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Commented] (COLLECTIONS-459) ArrayIterator & ObjectArrayIterator - do they need setters?`
Date Tue, 18 Jun 2013 10:35:20 GMT


Sebb commented on COLLECTIONS-459:

Thread-safety is only one of the issues here - it's possible for subclasses to destroy the
invariant, i.e. startIndex <= index <= endIndex.

How about making the index package protected?

That would at least prevent 3rd party classes from corrupting the index, and would allow it
to be made private later if necessary.

As for the array Object, that is less of an issue, though it would be trivial to add a get/set
method to the parent class.
> ArrayIterator & ObjectArrayIterator - do they need setters?`
> ------------------------------------------------------------
>                 Key: COLLECTIONS-459
>                 URL:
>             Project: Commons Collections
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 4.0
> ArrayIterator & ObjectArrayIterator both have methods to set the array separately
from the ctor.
> However the method does not allow the same flexibility as the ctor, as it does not allow
the start or end indexes to be set.
> Is there really a use-case for these setters? If not, all the fields apart from index
could be made final, which would make thread safety (and testing) easier.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see:

View raw message