Author: ggregory
Date: Mon Jan 7 18:00:46 2013
New Revision: 1429926
URL: http://svn.apache.org/viewvc?rev=1429926&view=rev
Log:
Where possible:
- Add final modifier to private fields
- Add final modifier to method parameters
- Add final modifier to local variables
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1429926&r1=1429925&r2=1429926&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
(original)
+++
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Mon Jan 7 18:00:46 2013
@@ -398,7 +398,7 @@ public class CSVFormat implements Serial
}
@Override
- public boolean equals(Object obj)
+ public boolean equals(final Object obj)
{
if (this == obj)
{
@@ -413,7 +413,7 @@ public class CSVFormat implements Serial
return false;
}
- CSVFormat other = (CSVFormat) obj;
+ final CSVFormat other = (CSVFormat) obj;
if (delimiter != other.delimiter)
{
return false;
@@ -543,7 +543,7 @@ public class CSVFormat implements Serial
*/
@SuppressWarnings("synthetic-access") // TODO fields could be made
package-protected
// package protected to give access without needing a synthetic
accessor
- CSVFormatBuilder(CSVFormat format) {
+ CSVFormatBuilder(final CSVFormat format) {
this(format.delimiter, format.quoteChar, format.quotePolicy,
format.commentStart, format.escape,
format.ignoreSurroundingSpaces, format.ignoreEmptyLines,
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java?rev=1429926&r1=1429925&r2=1429926&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatBuilderTest.java
Mon Jan 7 18:00:46 2013
@@ -158,23 +158,23 @@ public class CSVFormatBuilderTest {
@Test
public void testCopiedFormatIsEqualToOriginal() {
- CSVFormat copyOfRCF4180 = CSVFormat.newBuilder(RFC4180).build();
+ final CSVFormat copyOfRCF4180 = CSVFormat.newBuilder(RFC4180).build();
assertEquals(RFC4180, copyOfRCF4180);
}
@Test
public void testCopiedFormatWithChanges() {
- CSVFormat newFormat =
CSVFormat.newBuilder(RFC4180).withDelimiter('!').build();
+ final CSVFormat newFormat =
CSVFormat.newBuilder(RFC4180).withDelimiter('!').build();
assertTrue(newFormat.getDelimiter() != RFC4180.getDelimiter());
}
@Test
public void testHeaderReferenceCannotEscape() {
- String[] header = new String[]{"one", "tow", "three"};
+ final String[] header = new String[]{"one", "tow", "three"};
builder.withHeader(header);
- CSVFormat firstFormat = builder.build();
- CSVFormat secondFormat = builder.build();
+ final CSVFormat firstFormat = builder.build();
+ final CSVFormat secondFormat = builder.build();
assertNotSame(header, firstFormat.getHeader());
assertNotSame(firstFormat, secondFormat.getHeader());
}
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1429926&r1=1429925&r2=1429926&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
Mon Jan 7 18:00:46 2013
@@ -69,8 +69,8 @@ public class CSVFormatTest {
@Test
public void testEquals() {
- CSVFormat right = CSVFormat.DEFAULT;
- CSVFormat left = CSVFormat.newBuilder().build();
+ final CSVFormat right = CSVFormat.DEFAULT;
+ final CSVFormat left = CSVFormat.newBuilder().build();
assertFalse(right.equals(null));
assertFalse(right.equals("A String Instance"));
@@ -85,27 +85,27 @@ public class CSVFormatTest {
@Test
public void testEqualsDelimiter() {
- CSVFormat right = CSVFormat.newBuilder('!').build();
- CSVFormat left = CSVFormat.newBuilder('?').build();
+ final CSVFormat right = CSVFormat.newBuilder('!').build();
+ final CSVFormat left = CSVFormat.newBuilder('?').build();
assertNotEquals(right, left);
}
@Test
public void testEqualsQuoteChar() {
- CSVFormat right =
CSVFormat.newBuilder('\'').withQuoteChar('"').build();
- CSVFormat left =
CSVFormat.newBuilder(right).withQuoteChar('!').build();
+ final CSVFormat right =
CSVFormat.newBuilder('\'').withQuoteChar('"').build();
+ final CSVFormat left =
CSVFormat.newBuilder(right).withQuoteChar('!').build();
assertNotEquals(right, left);
}
@Test
public void testEqualsQuotePolicy() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withQuotePolicy(Quote.MINIMAL)
.build();
@@ -114,12 +114,12 @@ public class CSVFormatTest {
@Test
public void testEqualsCommentStart() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.withCommentStart('#')
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withCommentStart('!')
.build();
@@ -128,13 +128,13 @@ public class CSVFormatTest {
@Test
public void testEqualsEscape() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.withCommentStart('#')
.withEscape('+')
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withEscape('!')
.build();
@@ -143,14 +143,14 @@ public class CSVFormatTest {
@Test
public void testEqualsIgnoreSurroundingSpaces() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.withCommentStart('#')
.withEscape('+')
.withIgnoreSurroundingSpaces(true)
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withIgnoreSurroundingSpaces(false)
.build();
@@ -159,7 +159,7 @@ public class CSVFormatTest {
@Test
public void testEqualsIgnoreEmptyLines() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.withCommentStart('#')
@@ -167,7 +167,7 @@ public class CSVFormatTest {
.withIgnoreSurroundingSpaces(true)
.withIgnoreEmptyLines(true)
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withIgnoreEmptyLines(false)
.build();
@@ -176,7 +176,7 @@ public class CSVFormatTest {
@Test
public void testEqualsRecordSeparator() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.withCommentStart('#')
@@ -185,7 +185,7 @@ public class CSVFormatTest {
.withIgnoreEmptyLines(true)
.withRecordSeparator('*')
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withRecordSeparator('!')
.build();
@@ -194,7 +194,7 @@ public class CSVFormatTest {
@Test
public void testEqualsHeader() {
- CSVFormat right = CSVFormat.newBuilder('\'')
+ final CSVFormat right = CSVFormat.newBuilder('\'')
.withQuoteChar('"')
.withQuotePolicy(Quote.ALL)
.withCommentStart('#')
@@ -204,14 +204,14 @@ public class CSVFormatTest {
.withRecordSeparator('*')
.withHeader("One", "Two", "Three")
.build();
- CSVFormat left = CSVFormat.newBuilder(right)
+ final CSVFormat left = CSVFormat.newBuilder(right)
.withHeader("Three", "Two", "One")
.build();
assertNotEquals(right, left);
}
- private static void assertNotEquals(Object right, Object left) {
+ private static void assertNotEquals(final Object right, final Object left)
{
assertFalse(right.equals(left));
assertFalse(left.equals(right));
}