aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorRoel Spilker <r.spilker@gmail.com>2014-01-17 21:50:55 +0100
committerRoel Spilker <r.spilker@gmail.com>2014-01-17 21:50:55 +0100
commit3cca3e018b8867c960d83717af779c119870a316 (patch)
tree5cd4eafaa7d323912a97c60d25c37ee3754760b4 /src/core
parent493cf8231390af5500174091a3d1c0b27f0b0aee (diff)
downloadlombok-3cca3e018b8867c960d83717af779c119870a316.tar.gz
lombok-3cca3e018b8867c960d83717af779c119870a316.tar.bz2
lombok-3cca3e018b8867c960d83717af779c119870a316.zip
[configuration] Removed type parameter from ConfigurationSource.Result
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lombok/core/configuration/BubblingConfigurationResolver.java6
-rw-r--r--src/core/lombok/core/configuration/ConfigurationSource.java10
-rw-r--r--src/core/lombok/core/configuration/StringConfigurationSource.java27
3 files changed, 21 insertions, 22 deletions
diff --git a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java
index 440d7b68..2e7a76dc 100644
--- a/src/core/lombok/core/configuration/BubblingConfigurationResolver.java
+++ b/src/core/lombok/core/configuration/BubblingConfigurationResolver.java
@@ -44,7 +44,7 @@ public class BubblingConfigurationResolver implements ConfigurationResolver {
boolean isList = key.getType().isList();
List<ListModification> listModifications = null;
for (ConfigurationSource source : sources) {
- Result<T> result = source.resolve(key);
+ Result result = source.resolve(key);
if (result == null) continue;
if (isList) {
if (listModifications == null) {
@@ -57,9 +57,9 @@ public class BubblingConfigurationResolver implements ConfigurationResolver {
if (isList) {
break;
}
- return result.getValue();
+ return (T) result.getValue();
}
- Result<Boolean> stop = source.resolve(STOP_BUBBLING);
+ Result stop = source.resolve(STOP_BUBBLING);
if (stop != null && Boolean.TRUE.equals(stop.getValue())) break;
}
if (!isList) {
diff --git a/src/core/lombok/core/configuration/ConfigurationSource.java b/src/core/lombok/core/configuration/ConfigurationSource.java
index 03c73674..4a2b5808 100644
--- a/src/core/lombok/core/configuration/ConfigurationSource.java
+++ b/src/core/lombok/core/configuration/ConfigurationSource.java
@@ -23,18 +23,18 @@ package lombok.core.configuration;
public interface ConfigurationSource {
- <T> Result<T> resolve(ConfigurationKey<T> key);
+ Result resolve(ConfigurationKey<?> key);
- public static final class Result<T> {
- private final T value;
+ public static final class Result {
+ private final Object value;
private final boolean authoritative;
- public Result(T value, boolean authoritative) {
+ public Result(Object value, boolean authoritative) {
this.value = value;
this.authoritative = authoritative;
}
- public T getValue() {
+ public Object getValue() {
return value;
}
diff --git a/src/core/lombok/core/configuration/StringConfigurationSource.java b/src/core/lombok/core/configuration/StringConfigurationSource.java
index da01b6ee..d4de8ae1 100644
--- a/src/core/lombok/core/configuration/StringConfigurationSource.java
+++ b/src/core/lombok/core/configuration/StringConfigurationSource.java
@@ -34,12 +34,12 @@ public class StringConfigurationSource implements ConfigurationSource {
private static final Pattern LINE = Pattern.compile("(?:clear\\s+([^=]+))|(?:(\\S*?)\\s*([-+]?=)\\s*(.*?))");
- private final Map<String, Result<?>> values;
+ private final Map<String, Result> values;
public static ConfigurationSource forString(String content, ConfigurationErrorReporter reporter) {
if (reporter == null) throw new NullPointerException("reporter");
- Map<String, Result<?>> values = new TreeMap<String, Result<?>>(String.CASE_INSENSITIVE_ORDER);
+ Map<String, Result> values = new TreeMap<String, Result>(String.CASE_INSENSITIVE_ORDER);
Map<String, ConfigurationDataType> registeredKeys = ConfigurationKey.registeredKeysAsMap();
int lineNumber = 0;
@@ -84,19 +84,19 @@ public class StringConfigurationSource implements ConfigurationSource {
return new StringConfigurationSource(values);
}
- private StringConfigurationSource(Map<String, Result<?>> values) {
- this.values = new TreeMap<String, Result<?>>(String.CASE_INSENSITIVE_ORDER);
- for (Entry<String, Result<?>> entry : values.entrySet()) {
- Result<?> result = entry.getValue();
+ private StringConfigurationSource(Map<String, Result> values) {
+ this.values = new TreeMap<String, Result>(String.CASE_INSENSITIVE_ORDER);
+ for (Entry<String, Result> entry : values.entrySet()) {
+ Result result = entry.getValue();
if (result.getValue() instanceof List<?>) {
- this.values.put(entry.getKey(), new Result<List<?>>(Collections.unmodifiableList((List<?>) result.getValue()), result.isAuthoritative()));
+ this.values.put(entry.getKey(), new Result(Collections.unmodifiableList((List<?>) result.getValue()), result.isAuthoritative()));
} else {
this.values.put(entry.getKey(), result);
}
}
}
- private static void processResult(Map<String, Result<?>> values, String keyName, String operator, String value, ConfigurationDataType type, ConfigurationErrorReporter reporter, int lineNumber, String line) {
+ private static void processResult(Map<String, Result> values, String keyName, String operator, String value, ConfigurationDataType type, ConfigurationErrorReporter reporter, int lineNumber, String line) {
Object element = null;
if (value != null) try {
element = type.getParser().parse(value);
@@ -109,19 +109,18 @@ public class StringConfigurationSource implements ConfigurationSource {
if (element == null && type.isList()) {
element = new ArrayList<ListModification>();
}
- values.put(keyName, new Result<Object>(element, true));
+ values.put(keyName, new Result(element, true));
} else {
- Result<?> result = values.get(keyName);
+ Result result = values.get(keyName);
@SuppressWarnings("unchecked")
List<ListModification> list = result == null ? new ArrayList<ListModification>() : (List<ListModification>) result.getValue();
- if (result == null) values.put(keyName, new Result<Object>(list, false));
+ if (result == null) values.put(keyName, new Result(list, false));
list.add(new ListModification(element, operator.equals("+=")));
}
}
- @SuppressWarnings("unchecked")
@Override
- public <T> Result<T> resolve(ConfigurationKey<T> key) {
- return (Result<T>) values.get(key.getKeyName());
+ public Result resolve(ConfigurationKey<?> key) {
+ return values.get(key.getKeyName());
}
}