aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/delombok/lombok/delombok/FormatPreferenceScanner.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/delombok/lombok/delombok/FormatPreferenceScanner.java b/src/delombok/lombok/delombok/FormatPreferenceScanner.java
index cb9009dc..fc823ccb 100644
--- a/src/delombok/lombok/delombok/FormatPreferenceScanner.java
+++ b/src/delombok/lombok/delombok/FormatPreferenceScanner.java
@@ -37,18 +37,18 @@ import java.util.Map;
*/
public class FormatPreferenceScanner {
/** Checks validity of preferences, and returns with a non-null value if ALL format keys are available, thus negating the need for a scan. */
- private FormatPreferences tryEasy(Map<String, String> preferences) {
+ private FormatPreferences tryEasy(Map<String, String> preferences, boolean force) {
int count = 0;
for (Map.Entry<String, String> e : preferences.entrySet()) {
if (!FormatPreferences.KEYS.containsKey(e.getKey())) throw new IllegalArgumentException("Unknown format key: " + e.getKey());
if (!"scan".equalsIgnoreCase(e.getValue())) count++;
}
- if (count >= FormatPreferences.KEYS.size()) return new FormatPreferences(preferences, "\t", false);
+ if (force || count >= FormatPreferences.KEYS.size()) return new FormatPreferences(preferences, "\t", false);
return null;
}
public FormatPreferences scan(Map<String, String> preferences, final CharSequence source) {
- FormatPreferences fps = tryEasy(preferences);
+ FormatPreferences fps = tryEasy(preferences, source == null);
if (fps != null) return fps;
try {
@@ -76,7 +76,7 @@ public class FormatPreferenceScanner {
}
public FormatPreferences scan(Map<String, String> preferences, char[] source) {
- FormatPreferences fps = tryEasy(preferences);
+ FormatPreferences fps = tryEasy(preferences, source == null);
if (fps != null) return fps;
try {
@@ -87,7 +87,7 @@ public class FormatPreferenceScanner {
}
public FormatPreferences scan(Map<String, String> preferences, Reader in) throws IOException {
- FormatPreferences fps = tryEasy(preferences);
+ FormatPreferences fps = tryEasy(preferences, in == null);
if (fps != null) return fps;
return scan_(preferences, in);