This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git


The following commit(s) were added to refs/heads/master by this push:
     new e835cb2d Remove redundant keywords
e835cb2d is described below

commit e835cb2de9d81a80b5ab39a7b5cada60b4b31a87
Author: Gary Gregory <[email protected]>
AuthorDate: Tue Jul 9 08:05:38 2024 -0400

    Remove redundant keywords
---
 .../java/org/apache/commons/csv/CSVParser.java     |  4 +--
 .../java/org/apache/commons/csv/CSVPrinter.java    |  2 +-
 .../java/org/apache/commons/csv/CSVParserTest.java | 30 ++++++++++------------
 .../java/org/apache/commons/csv/CSVRecordTest.java |  6 ++---
 .../apache/commons/csv/perf/PerformanceTest.java   | 18 ++++++-------
 5 files changed, 29 insertions(+), 31 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/CSVParser.java 
b/src/main/java/org/apache/commons/csv/CSVParser.java
index 3cb32673..17e084f1 100644
--- a/src/main/java/org/apache/commons/csv/CSVParser.java
+++ b/src/main/java/org/apache/commons/csv/CSVParser.java
@@ -151,7 +151,7 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
 
         @Override
         public boolean hasNext() {
-            if (CSVParser.this.isClosed()) {
+            if (isClosed()) {
                 return false;
             }
             if (current == null) {
@@ -163,7 +163,7 @@ public final class CSVParser implements 
Iterable<CSVRecord>, Closeable {
 
         @Override
         public CSVRecord next() {
-            if (CSVParser.this.isClosed()) {
+            if (isClosed()) {
                 throw new NoSuchElementException("CSVParser has been closed");
             }
             CSVRecord next = current;
diff --git a/src/main/java/org/apache/commons/csv/CSVPrinter.java 
b/src/main/java/org/apache/commons/csv/CSVPrinter.java
index e60e917f..fd62df25 100644
--- a/src/main/java/org/apache/commons/csv/CSVPrinter.java
+++ b/src/main/java/org/apache/commons/csv/CSVPrinter.java
@@ -110,7 +110,7 @@ public final class CSVPrinter implements Flushable, 
Closeable {
         final String[] headerComments = format.getHeaderComments();
         if (headerComments != null) {
             for (final String line : headerComments) {
-                this.printComment(line);
+                printComment(line);
             }
         }
         if (format.getHeader() != null && !format.getSkipHeaderRecord()) {
diff --git a/src/test/java/org/apache/commons/csv/CSVParserTest.java 
b/src/test/java/org/apache/commons/csv/CSVParserTest.java
index f42df99a..eb246bb1 100644
--- a/src/test/java/org/apache/commons/csv/CSVParserTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVParserTest.java
@@ -54,13 +54,11 @@ import java.util.stream.Stream;
 
 import org.apache.commons.io.input.BOMInputStream;
 import org.apache.commons.io.input.BrokenInputStream;
-import org.apache.commons.lang3.stream.Streams.FailableStream;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.EnumSource;
-import org.junit.jupiter.params.provider.ValueSource;
 
 /**
  * CSVParserTest
@@ -754,17 +752,17 @@ public class CSVParserTest {
 
     @Test
     public void testGetLineNumberWithCR() throws Exception {
-        this.validateLineNumbers(String.valueOf(CR));
+        validateLineNumbers(String.valueOf(CR));
     }
 
     @Test
     public void testGetLineNumberWithCRLF() throws Exception {
-        this.validateLineNumbers(CRLF);
+        validateLineNumbers(CRLF);
     }
 
     @Test
     public void testGetLineNumberWithLF() throws Exception {
-        this.validateLineNumbers(String.valueOf(LF));
+        validateLineNumbers(String.valueOf(LF));
     }
 
     @Test
@@ -797,27 +795,27 @@ public class CSVParserTest {
 
     @Test
     public void testGetRecordNumberWithCR() throws Exception {
-        this.validateRecordNumbers(String.valueOf(CR));
+        validateRecordNumbers(String.valueOf(CR));
     }
 
     @Test
     public void testGetRecordNumberWithCRLF() throws Exception {
-        this.validateRecordNumbers(CRLF);
+        validateRecordNumbers(CRLF);
     }
 
     @Test
     public void testGetRecordNumberWithLF() throws Exception {
-        this.validateRecordNumbers(String.valueOf(LF));
+        validateRecordNumbers(String.valueOf(LF));
     }
 
     @Test
     public void testGetRecordPositionWithCRLF() throws Exception {
-        this.validateRecordPosition(CRLF);
+        validateRecordPosition(CRLF);
     }
 
     @Test
     public void testGetRecordPositionWithLF() throws Exception {
-        this.validateRecordPosition(String.valueOf(LF));
+        validateRecordPosition(String.valueOf(LF));
     }
 
     @Test
@@ -1329,7 +1327,7 @@ public class CSVParserTest {
             assertEquals("xyz", csvRecord.get(1));
         }
     }
-    
+
     @Test
     public void testParseWithDelimiterStringWithQuote() throws IOException {
         final String source = "'a[|]b[|]c'[|]xyz\r\nabc[abc][|]xyz";
@@ -1343,7 +1341,7 @@ public class CSVParserTest {
             assertEquals("xyz", csvRecord.get(1));
         }
     }
-    
+
     @Test
     public void testParseWithDelimiterWithEscape() throws IOException {
         final String source = "a!,b!,c,xyz";
@@ -1354,7 +1352,7 @@ public class CSVParserTest {
             assertEquals("xyz", csvRecord.get(1));
         }
     }
-    
+
     @Test
     public void testParseWithDelimiterWithQuote() throws IOException {
         final String source = "'a,b,c',xyz";
@@ -1365,7 +1363,7 @@ public class CSVParserTest {
             assertEquals("xyz", csvRecord.get(1));
         }
     }
-    
+
     @Test
     public void testParseWithQuoteThrowsException() {
         final CSVFormat csvFormat = CSVFormat.DEFAULT.withQuote('\'');
@@ -1373,7 +1371,7 @@ public class CSVParserTest {
         assertThrows(IOException.class, () -> csvFormat.parse(new 
StringReader("'a,b,c'abc,xyz")).nextRecord());
         assertThrows(IOException.class, () -> csvFormat.parse(new 
StringReader("'abc'a,b,c',xyz")).nextRecord());
     }
-    
+
     @Test
     public void testParseWithQuoteWithEscape() throws IOException {
         final String source = "'a?,b?,c?d',xyz";
@@ -1384,7 +1382,7 @@ public class CSVParserTest {
             assertEquals("xyz", csvRecord.get(1));
         }
     }
-    
+
     @ParameterizedTest
     @EnumSource(CSVFormat.Predefined.class)
     public void testParsingPrintedEmptyFirstColumn(final CSVFormat.Predefined 
format) throws Exception {
diff --git a/src/test/java/org/apache/commons/csv/CSVRecordTest.java 
b/src/test/java/org/apache/commons/csv/CSVRecordTest.java
index 15d3fec6..0da62fe5 100644
--- a/src/test/java/org/apache/commons/csv/CSVRecordTest.java
+++ b/src/test/java/org/apache/commons/csv/CSVRecordTest.java
@@ -236,10 +236,10 @@ public class CSVRecordTest {
     public void testPutInMap() {
         final Map<String, String> map = new ConcurrentHashMap<>();
         this.recordWithHeader.putIn(map);
-        this.validateMap(map, false);
+        validateMap(map, false);
         // Test that we can compile with assignment to the same map as the 
param.
         final TreeMap<String, String> map2 = recordWithHeader.putIn(new 
TreeMap<>());
-        this.validateMap(map2, false);
+        validateMap(map2, false);
     }
 
     @Test
@@ -339,7 +339,7 @@ public class CSVRecordTest {
     @Test
     public void testToMap() {
         final Map<String, String> map = this.recordWithHeader.toMap();
-        this.validateMap(map, true);
+        validateMap(map, true);
     }
 
     @Test
diff --git a/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java 
b/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java
index fcde8984..23bded2b 100644
--- a/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java
+++ b/src/test/java/org/apache/commons/csv/perf/PerformanceTest.java
@@ -100,10 +100,10 @@ public class PerformanceTest {
 
     public long testParseBigFile(final boolean traverseColumns) throws 
Exception {
         final long startMillis = System.currentTimeMillis();
-        try (final BufferedReader reader = this.createBufferedReader()) {
-            final long count = this.parse(reader, traverseColumns);
+        try (final BufferedReader reader = createBufferedReader()) {
+            final long count = parse(reader, traverseColumns);
             final long totalMillis = System.currentTimeMillis() - startMillis;
-            this.println(
+            println(
                 String.format("File parsed in %,d milliseconds with Commons 
CSV: %,d lines.", totalMillis, count));
             return totalMillis;
         }
@@ -113,9 +113,9 @@ public class PerformanceTest {
     public void testParseBigFileRepeat() throws Exception {
         long bestTime = Long.MAX_VALUE;
         for (int i = 0; i < this.max; i++) {
-            bestTime = Math.min(this.testParseBigFile(false), bestTime);
+            bestTime = Math.min(testParseBigFile(false), bestTime);
         }
-        this.println(String.format("Best time out of %,d is %,d 
milliseconds.", this.max, bestTime));
+        println(String.format("Best time out of %,d is %,d milliseconds.", 
this.max, bestTime));
     }
 
     @Test
@@ -124,14 +124,14 @@ public class PerformanceTest {
         long count;
         for (int i = 0; i < this.max; i++) {
             final long startMillis;
-            try (final BufferedReader in = this.createBufferedReader()) {
+            try (final BufferedReader in = createBufferedReader()) {
                 startMillis = System.currentTimeMillis();
-                count = this.readAll(in);
+                count = readAll(in);
             }
             final long totalMillis = System.currentTimeMillis() - startMillis;
             bestTime = Math.min(totalMillis, bestTime);
-            this.println(String.format("File read in %,d milliseconds: %,d 
lines.", totalMillis, count));
+            println(String.format("File read in %,d milliseconds: %,d lines.", 
totalMillis, count));
         }
-        this.println(String.format("Best time out of %,d is %,d 
milliseconds.", this.max, bestTime));
+        println(String.format("Best time out of %,d is %,d milliseconds.", 
this.max, bestTime));
     }
 }
\ No newline at end of file

Reply via email to