From b9e98648933482398b8f1b5e263e784cc3db2179 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 24 Mar 2011 15:15:21 +0300 Subject: [PATCH] cleanup --- .../com/intellij/openapi/actionSystem/DataKey.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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); }