From 58adc5cb39e944fc544d6a8ac3d677e5ecf4e504 Mon Sep 17 00:00:00 2001 From: Sergey Evdokimov Date: Tue, 6 Sep 2011 19:05:56 +0400 Subject: [PATCH] Fix assertion error: GrCloseableBlockImpl incorrectly cleared caches. --- .../blocks/GrClosableBlockImpl.java | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java index 82aa46ea9d97..ee9cd8fbef5f 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/psi/impl/statements/blocks/GrClosableBlockImpl.java @@ -68,10 +68,9 @@ public class GrClosableBlockImpl extends GrBlockImpl implements GrClosableBlock } @Override - public PsiElement copy() { - final GrClosableBlockImpl clone = (GrClosableBlockImpl)super.copy(); - clone.mySyntheticItParameter = null; - return clone; + public void clearCaches() { + super.clearCaches(); + mySyntheticItParameter = null; } public boolean processDeclarations(final @NotNull PsiScopeProcessor processor, @@ -181,21 +180,18 @@ public class GrClosableBlockImpl extends GrBlockImpl implements GrClosableBlock return getType(); } - public void subtreeChanged() { - super.subtreeChanged(); - mySyntheticItParameter = null; - } - public GrParameter getSyntheticItParameter() { - if (mySyntheticItParameter == null) { - GrParameter fresh = new ClosureSyntheticParameter(this); + GrParameter res = mySyntheticItParameter; + if (res == null) { + res = new ClosureSyntheticParameter(this); synchronized (this) { if (mySyntheticItParameter == null) { - mySyntheticItParameter = fresh; + mySyntheticItParameter = res; } } } - return mySyntheticItParameter; + + return res; } private PsiVariable getOwner() {