From e83a9b7eaa434978b978cb0d4e7a3e655a5ddbba Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Thu, 13 Sep 2012 19:05:02 +0400 Subject: [PATCH] Added check for null values in collection passed to CompilerConfiguration. --- .../jetbrains/jet/config/CompilerConfiguration.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/compiler/frontend/src/org/jetbrains/jet/config/CompilerConfiguration.java b/compiler/frontend/src/org/jetbrains/jet/config/CompilerConfiguration.java index 7faddc68fe8..5bf4b3f328b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/config/CompilerConfiguration.java +++ b/compiler/frontend/src/org/jetbrains/jet/config/CompilerConfiguration.java @@ -70,6 +70,7 @@ public class CompilerConfiguration { public void addAll(@NotNull CompilerConfigurationKey> key, @NotNull Collection values) { checkReadOnly(); + checkForNullElements(values); Key> ideaKey = key.ideaKey; if (map.get(ideaKey) == null) { map.put(ideaKey, new ArrayList()); @@ -112,4 +113,15 @@ public class CompilerConfiguration { return object; } } + + private static void checkForNullElements(Collection values) { + int index = 0; + for (T value : values) { + if (value == null) { + throw new IllegalArgumentException("Element " + index + + " is null, while null values in compiler configuration are not allowed"); + } + index++; + } + } }