From 8562f84fb97bf0510cd11aad3b47b953d622d676 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 16 Oct 2009 19:10:49 +0400 Subject: [PATCH] mem leak --- .../defaultFileTemplateUsage/MethodBodyChecker.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java b/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java index 59bb9d765d20..d894108cfcf3 100644 --- a/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java +++ b/java/java-impl/src/com/intellij/codeInspection/defaultFileTemplateUsage/MethodBodyChecker.java @@ -60,7 +60,7 @@ public class MethodBodyChecker { final String fileTemplateName = template.getName(); String methodName = superSignatures.isEmpty() ? "" : superSignatures.get(0).getName(); String key = returnType.getCanonicalText() + "+" + methodName + "+"+fileTemplateName; - final Map cache = getTemplatesCache(project); + final Map cache = getTemplatesCache(aClass); PsiMethod method = cache.get(key); if (method == null) { method = JavaPsiFacade.getInstance(project).getElementFactory().createMethod("x", returnType); @@ -74,12 +74,12 @@ public class MethodBodyChecker { } } - private static final Key> CACHE_IN_PROJECT_KEY = new Key>("MethodBodyChecker templates cache"); + private static final Key> CACHE_KEY = new Key>("MethodBodyChecker templates cache"); - private static Map getTemplatesCache(Project project) { - Map cache = project.getUserData(CACHE_IN_PROJECT_KEY); + private static Map getTemplatesCache(PsiClass aClass) { + Map cache = aClass.getUserData(CACHE_KEY); if (cache == null) { - cache = ((UserDataHolderEx)project).putUserDataIfAbsent(CACHE_IN_PROJECT_KEY, new ConcurrentHashMap()); + cache = ((UserDataHolderEx)aClass).putUserDataIfAbsent(CACHE_KEY, new ConcurrentHashMap()); } return cache; }