From 5528e1155b4a13ae359f65ba3b01c10acef01a94 Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Tue, 11 Oct 2016 04:55:51 +0300 Subject: [PATCH] employ UserDataHolderEx#putUserDataIfAbsent if available --- .../src/com/intellij/openapi/util/NotNullLazyKey.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java b/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java index 36dae48a5bfe..7d093107a3f4 100644 --- a/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java +++ b/platform/util/src/com/intellij/openapi/util/NotNullLazyKey.java @@ -15,9 +15,9 @@ */ package com.intellij.openapi.util; +import com.intellij.util.NotNullFunction; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import com.intellij.util.NotNullFunction; /** * @author peter @@ -38,7 +38,12 @@ public class NotNullLazyKey extends Key{ RecursionGuard.StackStamp stamp = ourGuard.markStack(); data = myFunction.fun(h); if (stamp.mayCacheNow()) { - h.putUserData(this, data); + if (h instanceof UserDataHolderEx) { + data = ((UserDataHolderEx)h).putUserDataIfAbsent(this, data); + } + else { + h.putUserData(this, data); + } } } return data;