aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-02-06 21:24:02 +0100
committerRoel Spilker <r.spilker@gmail.com>2014-02-06 21:24:02 +0100
commit143143276da646bcc9a195d827364f8499187a6a (patch)
tree8f93cb21e968988d4980e18015b17de69a71dc1d /src/core/lombok
parent293422803392543c6eb170db87d08f7cb54aafe6 (diff)
downloadlombok-143143276da646bcc9a195d827364f8499187a6a.tar.gz
lombok-143143276da646bcc9a195d827364f8499187a6a.tar.bz2
lombok-143143276da646bcc9a195d827364f8499187a6a.zip
[configuration] Have the ConfigurationApp print platform-specific newLine characters, and print clear for empty lists.
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/core/configuration/ConfigurationApp.java48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/core/lombok/core/configuration/ConfigurationApp.java b/src/core/lombok/core/configuration/ConfigurationApp.java
index a1ca3597..e441b4de 100644
--- a/src/core/lombok/core/configuration/ConfigurationApp.java
+++ b/src/core/lombok/core/configuration/ConfigurationApp.java
@@ -145,20 +145,20 @@ public class ConfigurationApp extends LombokApp {
out.println();
continue;
}
- out.printf("##\n## Key : %s\n## Type: %s\n", keyName, type);
+ out.printf("##%n## Key : %s%n## Type: %s%n", keyName, type);
if (hasDescription) {
- out.printf("##\n## %s\n", description);
+ out.printf("##%n## %s%n", description);
}
- out.println("##\n## Examples:\n#");
- out.printf("# clear %s\n", keyName);
+ out.printf("##%n## Examples:%n#%n");
+ out.printf("# clear %s%n", keyName);
String exampleValue = type.getParser().exampleValue();
if (type.isList()) {
- out.printf("# %s += %s\n", keyName, exampleValue);
- out.printf("# %s -= %s\n", keyName, exampleValue);
+ out.printf("# %s += %s%n", keyName, exampleValue);
+ out.printf("# %s -= %s%n", keyName, exampleValue);
} else {
- out.printf("# %s = %s\n", keyName, exampleValue);
+ out.printf("# %s = %s%n", keyName, exampleValue);
}
- out.println("#\n");
+ out.printf("#%n%n");
}
if (!verbose) {
out.println("Use --verbose for more information.");
@@ -174,10 +174,10 @@ public class ConfigurationApp extends LombokApp {
Set<String> none = sharedDirectories.remove(NO_CONFIG);
if (none != null) {
if (none.size() == 1) {
- out.printf("No 'lombok.config' found for '%s'.\n", none.iterator().next());
+ out.printf("No 'lombok.config' found for '%s'.%n", none.iterator().next());
} else {
out.println("No 'lombok.config' found for: ");
- for (String path : none) out.printf("- %s\n", path);
+ for (String path : none) out.printf("- %s%n", path);
}
}
@@ -192,14 +192,14 @@ public class ConfigurationApp extends LombokApp {
boolean first = true;
for (Entry<URI, Set<String>> entry : sharedDirectories.entrySet()) {
if (!first) {
- out.print("\n\n");
+ out.printf("%n%n");
}
Set<String> paths = entry.getValue();
if (paths.size() == 1) {
- if (!(argsPaths.size() == 1)) out.printf("Configuration for '%s'.\n\n", paths.iterator().next());
+ if (!(argsPaths.size() == 1)) out.printf("Configuration for '%s'.%n%n", paths.iterator().next());
} else {
- out.printf("Configuration for:\n", paths.iterator().next());
- for (String path : paths) out.printf("- %s\n", path);
+ out.printf("Configuration for:%n", paths.iterator().next());
+ for (String path : paths) out.printf("- %s%n", path);
out.println();
}
URI directory = entry.getKey();
@@ -220,24 +220,26 @@ public class ConfigurationApp extends LombokApp {
}
if (!problems.isEmpty()) {
- out.printf("\nProblems in the configuration files: \n");
- for (String problem : problems) out.printf("- %s\n", problem);
+ out.printf("%nProblems in the configuration files: %n");
+ for (String problem : problems) out.printf("- %s%n", problem);
}
return 0;
}
private void printValue(ConfigurationKey<?> key, Object value, boolean verbose, Collection<String> history) {
- if (verbose) out.printf("# %s\n", key.getDescription());
+ if (verbose) out.printf("# %s%n", key.getDescription());
if (value == null) {
- out.printf("clear %s\n", key.getKeyName());
+ out.printf("clear %s%n", key.getKeyName());
} else if (value instanceof List<?>) {
- for (Object element : (List<?>)value) out.printf("%s += %s\n", key.getKeyName(), element);
+ List<?> list = (List<?>)value;
+ if (list.isEmpty()) out.printf("clear %s%n", key.getKeyName());
+ for (Object element : list) out.printf("%s += %s%n", key.getKeyName(), element);
} else {
- out.printf("%s = %s\n", key.getKeyName(), value);
+ out.printf("%s = %s%n", key.getKeyName(), value);
}
if (!verbose) return;
- for (String modification : history) out.printf("# %s\n", modification);
+ for (String modification : history) out.printf("# %s%n", modification);
}
private static final ConfigurationProblemReporter VOID = new ConfigurationProblemReporter() {
@@ -330,7 +332,7 @@ public class ConfigurationApp extends LombokApp {
for (String keyName : keyList) {
ConfigurationKey<?> key = registeredKeys.get(keyName);
if (key == null) {
- err.printf("Unknown key '%s'\n", keyName);
+ err.printf("Unknown key '%s'%n", keyName);
return null;
}
keys.remove(key);
@@ -348,7 +350,7 @@ public class ConfigurationApp extends LombokApp {
for (String path : paths) {
File file = new File(path);
if (!file.exists()) {
- err.printf("File not found: '%s'\n", path);
+ err.printf("File not found: '%s'%n", path);
return null;
}
URI first = findFirstLombokDirectory(file);