Refactor compiler arguments to configuration conversion:

extract into independent functions, rearrange logic
This commit is contained in:
Ilya Chernikov
2019-01-08 18:00:45 +01:00
parent 298aaf999e
commit 04b04ea0ee
11 changed files with 431 additions and 333 deletions
@@ -73,6 +73,12 @@ public class CompilerConfiguration {
map.put(key.ideaKey, value);
}
public <T> void putIfNotNull(@NotNull CompilerConfigurationKey<T> key, @Nullable T value) {
if (value != null) {
put(key, value);
}
}
public <T> void add(@NotNull CompilerConfigurationKey<List<T>> key, @NotNull T value) {
checkReadOnly();
Key<List<T>> ideaKey = key.ideaKey;
@@ -89,8 +95,10 @@ public class CompilerConfiguration {
data.put(key, value);
}
public <T> void addAll(@NotNull CompilerConfigurationKey<List<T>> key, @NotNull Collection<T> values) {
addAll(key, getList(key).size(), values);
public <T> void addAll(@NotNull CompilerConfigurationKey<List<T>> key, @Nullable Collection<T> values) {
if (values != null) {
addAll(key, getList(key).size(), values);
}
}
public <T> void addAll(@NotNull CompilerConfigurationKey<List<T>> key, int index, @NotNull Collection<T> values) {