diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataKey.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataKey.java index e8f09344f49a..e6bf2e36b339 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataKey.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataKey.java @@ -43,15 +43,17 @@ public class DataKey { } public static DataKey create(@NotNull @NonNls String name) { - if (ourDataKeyIndex.containsKey(name)) { - //noinspection unchecked - return ourDataKeyIndex.get(name); + //noinspection unchecked + DataKey key = ourDataKeyIndex.get(name); + if (key != null) { + return key; } - DataKey key = new DataKey(name); + key = new DataKey(name); ourDataKeyIndex.put(name, key); return key; } + @NotNull public String getName() { return myName; } @@ -74,7 +76,7 @@ public class DataKey { } @Nullable - public T getData(DataProvider dataProvider) { + public T getData(@NotNull DataProvider dataProvider) { //noinspection unchecked return (T) dataProvider.getData(myName); }