On 18 March 2013 17:16,  <ggreg...@apache.org> wrote:
> Author: ggregory
> Date: Mon Mar 18 17:16:42 2013
> New Revision: 1457876
>
> URL: http://svn.apache.org/r1457876
> Log:
> Use final for read-only local variables.
>
> Modified:
>     
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
>     
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bidimap/DualLinkedHashBidiMap.java
>     
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/IndexedCollection.java
>     
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TreeList.java
>     
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
>     
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
>     
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
>     
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java
>     
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/NodeListIteratorTest.java
>
> Modified: 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/CollectionUtils.java
>  Mon Mar 18 17:16:42 2013
> @@ -584,6 +584,7 @@ public class CollectionUtils {
>                  return false;
>              }
>              @SuppressWarnings("unchecked")
> +            final

Why
on separate line? Looks
odd.

>              EquatorWrapper<O> otherObj = (EquatorWrapper<O>) obj;
>              return equator.equate(object, otherObj.getObject());
>          }
>
> Modified: 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bidimap/DualLinkedHashBidiMap.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bidimap/DualLinkedHashBidiMap.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bidimap/DualLinkedHashBidiMap.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/bidimap/DualLinkedHashBidiMap.java
>  Mon Mar 18 17:16:42 2013
> @@ -94,6 +94,7 @@ public class DualLinkedHashBidiMap<K, V>
>          normalMap = new LinkedHashMap<K, V>();
>          reverseMap = new LinkedHashMap<V, K>();
>          @SuppressWarnings("unchecked") // will fail at runtime if stream is 
> incorrect
> +        final

Ditto

>          Map<K, V> map = (Map<K, V>) in.readObject();
>          putAll(map);
>      }
>
> Modified: 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/IndexedCollection.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/IndexedCollection.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/IndexedCollection.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/collection/IndexedCollection.java
>  Mon Mar 18 17:16:42 2013
> @@ -176,6 +176,7 @@ public class IndexedCollection<K, C> ext
>       */
>      public C get(final K key) {
>          @SuppressWarnings("unchecked") // index is a MultiMap which returns 
> a Collection
> +        final

Ditto

>          Collection<C> coll = (Collection<C>) index.get(key);
>          return coll == null ? null : coll.iterator().next();
>      }
>
> Modified: 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TreeList.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TreeList.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TreeList.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/list/TreeList.java
>  Mon Mar 18 17:16:42 2013
> @@ -429,7 +429,7 @@ public class TreeList<E> extends Abstrac
>              if (relativePosition >= 0) {
>                  relativePosition++;
>              }
> -            AVLNode<E> ret = balance();
> +            final AVLNode<E> ret = balance();
>              recalcHeight();
>              return ret;
>          }
> @@ -443,7 +443,7 @@ public class TreeList<E> extends Abstrac
>              if (relativePosition < 0) {
>                  relativePosition--;
>              }
> -            AVLNode<E> ret = balance();
> +            final AVLNode<E> ret = balance();
>              recalcHeight();
>              return ret;
>          }
>
> Modified: 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/main/java/org/apache/commons/collections/map/MultiKeyMap.java
>  Mon Mar 18 17:16:42 2013
> @@ -823,7 +823,7 @@ public class MultiKeyMap<K, V> extends A
>      public MultiKeyMap<K, V> clone() {
>          try {
>              return (MultiKeyMap<K, V>) super.clone();
> -        } catch (CloneNotSupportedException e) {
> +        } catch (final CloneNotSupportedException e) {
>              throw new InternalError();
>          }
>      }
>
> Modified: 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/CollectionUtilsTest.java
>  Mon Mar 18 17:16:42 2013
> @@ -510,7 +510,7 @@ public class CollectionUtilsTest extends
>
>      @Test
>      public void testIsEqualCollectionEquator() {
> -        Collection<Integer> collB = CollectionUtils.collect(collectionB, 
> TRANSFORM_TO_INTEGER);
> +        final Collection<Integer> collB = 
> CollectionUtils.collect(collectionB, TRANSFORM_TO_INTEGER);
>
>          // odd / even equator
>          final Equator<Integer> e = new Equator<Integer>() {
> @@ -993,12 +993,12 @@ public class CollectionUtilsTest extends
>
>      @Test
>      public void filterInverse() {
> -        List<Integer> ints = new ArrayList<Integer>();
> +        final List<Integer> ints = new ArrayList<Integer>();
>          ints.add(1);
>          ints.add(2);
>          ints.add(3);
>          ints.add(3);
> -        Iterable<Integer> iterable = ints;
> +        final Iterable<Integer> iterable = ints;
>          assertTrue(CollectionUtils.filterInverse(iterable, EQUALS_TWO));
>          assertEquals(3, ints.size());
>          assertEquals(1, (int) ints.get(0));
> @@ -1008,7 +1008,7 @@ public class CollectionUtilsTest extends
>
>      @Test
>      public void filterInverseNullParameters() throws Exception {
> -        List<Long> longs = Collections.nCopies(4, 10L);
> +        final List<Long> longs = Collections.nCopies(4, 10L);
>          assertFalse(CollectionUtils.filterInverse(longs, null));
>          assertEquals(4, longs.size());
>          assertFalse(CollectionUtils.filterInverse(null, EQUALS_TWO));
>
> Modified: 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/IteratorUtilsTest.java
>  Mon Mar 18 17:16:42 2013
> @@ -795,8 +795,8 @@ public class IteratorUtilsTest extends B
>       * Tests method nodeListIterator(NodeList)
>       */
>      public void testNodeListIterator() {
> -        Node[] nodes = createNodes();
> -        NodeList nodeList = createNodeList(nodes);
> +        final Node[] nodes = createNodes();
> +        final NodeList nodeList = createNodeList(nodes);
>
>          final Iterator<Node> iterator = 
> IteratorUtils.nodeListIterator(nodeList);
>          int expectedNodeIndex = 0;
> @@ -817,9 +817,9 @@ public class IteratorUtilsTest extends B
>       * Tests method nodeListIterator(Node)
>       */
>      public void testNodeIterator() {
> -        Node[] nodes = createNodes();
> -        NodeList nodeList = createNodeList(nodes);
> -        Node parentNode = createMock(Node.class);
> +        final Node[] nodes = createNodes();
> +        final NodeList nodeList = createNodeList(nodes);
> +        final Node parentNode = createMock(Node.class);
>          expect(parentNode.getChildNodes()).andStubReturn(nodeList);
>          replay(parentNode);
>
> @@ -844,10 +844,10 @@ public class IteratorUtilsTest extends B
>       * @return
>       */
>      private Node[] createNodes() {
> -        Node node1 = createMock(Node.class);
> -        Node node2 = createMock(Node.class);
> -        Node node3 = createMock(Node.class);
> -        Node node4 = createMock(Node.class);
> +        final Node node1 = createMock(Node.class);
> +        final Node node2 = createMock(Node.class);
> +        final Node node3 = createMock(Node.class);
> +        final Node node4 = createMock(Node.class);
>          replay(node1);
>          replay(node2);
>          replay(node3);
>
> Modified: 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/collection/IndexedCollectionTest.java
>  Mon Mar 18 17:16:42 2013
> @@ -133,14 +133,14 @@ public class IndexedCollectionTest exten
>          try {
>              coll.add("1");
>              fail();
> -        } catch (IllegalArgumentException e) {
> +        } catch (final IllegalArgumentException e) {
>              // expected
>          }
>      }
>
>      public void testDecoratedCollectionIsIndexedOnCreation() throws 
> Exception {
> -        Collection<String> original = makeFullCollection();
> -        IndexedCollection<Integer, String> indexed = 
> decorateUniqueCollection(original);
> +        final Collection<String> original = makeFullCollection();
> +        final IndexedCollection<Integer, String> indexed = 
> decorateUniqueCollection(original);
>
>          assertEquals("1", indexed.get(1));
>          assertEquals("2", indexed.get(2));
> @@ -148,8 +148,8 @@ public class IndexedCollectionTest exten
>      }
>
>      public void 
> testReindexUpdatesIndexWhenDecoratedCollectionIsModifiedSeparately() throws 
> Exception {
> -        Collection<String> original = new ArrayList<String>();
> -        IndexedCollection<Integer, String> indexed = 
> decorateUniqueCollection(original);
> +        final Collection<String> original = new ArrayList<String>();
> +        final IndexedCollection<Integer, String> indexed = 
> decorateUniqueCollection(original);
>
>          original.add("1");
>          original.add("2");
>
> Modified: 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/NodeListIteratorTest.java
> URL: 
> http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/NodeListIteratorTest.java?rev=1457876&r1=1457875&r2=1457876&view=diff
> ==============================================================================
> --- 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/NodeListIteratorTest.java
>  (original)
> +++ 
> commons/proper/collections/trunk/src/test/java/org/apache/commons/collections/iterators/NodeListIteratorTest.java
>  Mon Mar 18 17:16:42 2013
> @@ -54,10 +54,10 @@ public class NodeListIteratorTest extend
>
>
>          // create mocked Node Instances and fill Node[] to be used by test 
> cases
> -        Node node1 = createMock(Element.class);
> -        Node node2 = createMock(Element.class);
> -        Node node3 = createMock(Text.class);
> -        Node node4 = createMock(Element.class);
> +        final Node node1 = createMock(Element.class);
> +        final Node node2 = createMock(Element.class);
> +        final Node node3 = createMock(Text.class);
> +        final Node node4 = createMock(Element.class);
>          nodes = new Node[] {node1, node2, node3, node4};
>
>          replay(node1);
> @@ -68,7 +68,7 @@ public class NodeListIteratorTest extend
>
>      @Override
>      public Iterator<Node> makeEmptyIterator() {
> -        NodeList emptyNodeList = new NodeList() {
> +        final NodeList emptyNodeList = new NodeList() {
>              public Node item(final int index) {
>                  throw new IndexOutOfBoundsException();
>              }
> @@ -80,7 +80,7 @@ public class NodeListIteratorTest extend
>          if (createIteratorWithStandardConstr) {
>              return new NodeListIterator(emptyNodeList);
>          } else {
> -            Node parentNode = createMock(Node.class);
> +            final Node parentNode = createMock(Node.class);
>              expect(parentNode.getChildNodes()).andStubReturn(emptyNodeList);
>              replay(parentNode);
>
> @@ -90,7 +90,7 @@ public class NodeListIteratorTest extend
>
>      @Override
>      public Iterator<Node> makeObject() {
> -        NodeList nodeList = new NodeList() {
> +        final NodeList nodeList = new NodeList() {
>              public Node item(final int index) {
>                  return nodes[index];
>              }
> @@ -111,9 +111,10 @@ public class NodeListIteratorTest extend
>      public void testNullConstructor(){
>          try{
>              @SuppressWarnings("unused")
> +            final
>              NodeListIterator iter = new NodeListIterator((Node) null);
>              fail("IllegalArgumentException expected!");
> -        }catch(IllegalArgumentException e){
> +        }catch(final IllegalArgumentException e){
>              // expected.
>          }
>      }
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to