From 713e9c5382476d5e309ac4e18b1dba8f060f3837 Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Tue, 20 Nov 2012 23:22:21 +0000 Subject: [PATCH] Make some methods package-protected to avoid the need for synthetic accessors. TODO consider whether to do so for the fields as well git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1411919 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/csv/CSVFormat.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/commons/csv/CSVFormat.java b/src/main/java/org/apache/commons/csv/CSVFormat.java index 1c6fda27..7e9405ab 100644 --- a/src/main/java/org/apache/commons/csv/CSVFormat.java +++ b/src/main/java/org/apache/commons/csv/CSVFormat.java @@ -175,9 +175,9 @@ public class CSVFormat implements Serializable { * the header * @throws IllegalArgumentException if the delimiter is a line break character */ - private CSVFormat(final char delimiter, final Character quoteChar, final Quote quotePolicy, final Character commentStart, final Character escape, final - boolean ignoreSurroundingSpaces, final boolean ignoreEmptyLines, final String lineSeparator, - final String[] header) + // package protected to give access without needing a synthetic accessor + CSVFormat(final char delimiter, final Character quoteChar, final Quote quotePolicy, final Character commentStart, final Character escape, + final boolean ignoreSurroundingSpaces, final boolean ignoreEmptyLines, final String lineSeparator, final String[] header) { if (isLineBreak(delimiter)) { @@ -202,7 +202,8 @@ public class CSVFormat implements Serializable { * * @return true if c is a line break character */ - private static boolean isLineBreak(final Character c) { + // package protected to give access without needing a synthetic accessor + static boolean isLineBreak(final Character c) { return c != null && isLineBreak(c.charValue()); } @@ -214,7 +215,8 @@ public class CSVFormat implements Serializable { * * @return true if c is a line break character */ - private static boolean isLineBreak(final char c) { + // package protected to give access without needing a synthetic accessor + static boolean isLineBreak(final char c) { return c == LF || c == CR; } @@ -539,7 +541,9 @@ public class CSVFormat implements Serializable { * @param format * The format to use values from */ - private CSVFormatBuilder(CSVFormat format) { + @SuppressWarnings("synthetic-access") // TODO fields could be made package-protected + // package protected to give access without needing a synthetic accessor + CSVFormatBuilder(CSVFormat format) { this(format.delimiter, format.quoteChar, format.quotePolicy, format.commentStart, format.escape, format.ignoreSurroundingSpaces, format.ignoreEmptyLines, @@ -553,7 +557,8 @@ public class CSVFormat implements Serializable { * the char used for value separation, must not be a line break character * @throws IllegalArgumentException if the delimiter is a line break character */ - private CSVFormatBuilder(final char delimiter){ + // package protected to give access without needing a synthetic accessor + CSVFormatBuilder(final char delimiter){ this(delimiter, null, null, null, null, false, false, null, null); }