From f668c2bfc4c45ac9df9e11a9c0e5c260f36d7365 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 19 May 2015 16:52:55 +0200 Subject: [PATCH] clear cls method hierarchy cache not only on root change (EA-68165 - PIEAE: ClsRepositoryPsiElement.getManager) --- .../psi/impl/PsiSuperMethodImplUtil.java | 11 ++++------ .../methodHierarchy/AbstractMessageLite.class | Bin 0 -> 2657 bytes .../methodHierarchy/MessageLite.class | Bin 0 -> 817 bytes .../psi/resolve/ResolveInLibrariesTest.groovy | 20 ++++++++++++++++++ .../psi/PsiInvalidElementAccessException.java | 10 +++++++-- 5 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 java/java-tests/testData/libResolve/methodHierarchy/AbstractMessageLite.class create mode 100644 java/java-tests/testData/libResolve/methodHierarchy/MessageLite.class diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java index 85d22f0077d4..7966b5a89fc2 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiSuperMethodImplUtil.java @@ -18,7 +18,6 @@ package com.intellij.psi.impl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ProjectRootModificationTracker; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.psi.*; @@ -395,12 +394,10 @@ public class PsiSuperMethodImplUtil { result = new HierarchicalMethodSignatureImpl((MethodSignatureBackedByPsiMethod)method.getSignature(PsiSubstitutor.EMPTY)); } - Project project = aClass == null ? method.getProject() : aClass.getProject(); - // cache Cls method hierarchy until root changed - Object dependency = method instanceof PsiCompiledElement ? ProjectRootModificationTracker.getInstance(project) : - !method.isPhysical() ? method : - PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT; - return CachedValueProvider.Result.create(result, dependency); + if (!method.isPhysical()) { + return CachedValueProvider.Result.create(result, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, method); + } + return CachedValueProvider.Result.create(result, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT); } }; diff --git a/java/java-tests/testData/libResolve/methodHierarchy/AbstractMessageLite.class b/java/java-tests/testData/libResolve/methodHierarchy/AbstractMessageLite.class new file mode 100644 index 0000000000000000000000000000000000000000..8458684e52762041620050d59bbd4780a711c304 GIT binary patch literal 2657 zcmb7GTUQfT7~Mkx1H;HwDNxi6zh}a$Z}ExV9f5TX7vD=dOxM#VCl3>53V;ckQLO zuGn%N(<&(VEFP}hkfBb*uDU9oQ(2bIdf8Wg7;h3B}EIWXQBDbr4+*B}0v z6J^)5E$+4ZxE3A9cuN}MV|z;^#}Sok$yLzg%?P7hBZtS{ zwiOJ->yA&!NYeYlw-jjPabGxF=1)Yfq=_;o3GfYYyM6!$q04i%B1+~VUFM}vts)q% z61DRRVwO1Cv1G7oOSQPvZ78^VPB1Q1<0-W*yXxe`BU2_ye@NUXBR zjy=58@g2U`F^L~^yuyfr-jLWR81z<4hE+&yRxQ^&6ambSw`yl(I>lT&X2crtkGVxh z9K{SP7Kn8$UMbquQl5Og5l*aVl*_^zn~>-X6FVVevF*R`w7kp#1y}Fu^rYXCUWp%E0~O@|E-Fga?h0Qp#Q*yWeqzg z_X9%pTb+pi#{wWPcXL)&UIkQY1i~+WGl7-uqGKP)(mErRZiJC=1`6u|xky_T*RXQD zddc|SQaBN3R7pWst|)S^*X*sbkrNrQ&%79t4;>rg0=67R#N!?Pr2t%L2=?BBv!Wqv6yCa+mx?hxvl`LBS_{WLwy? z@UXqg*))5FeRJYHlwUb$!Zo%Udtd@l-pcD7>AnzR80L)66h_!e14opRvcrjEG@T%l zNhFUEJw`LTmUo#CXx;5;OTLHpr)T0ak*GB%eQ2iQ6rb{Gbm0zn?h@ra&tVJ^u3y3^ zZc?ug?TBN{voKr-kwCHr;%9=0(AJ0q@q23~d4l%U#4V!WrzdMLE;V5Ek&2Hnu5kp+ zv7P5R7toDG`NKhpW%OgkgOi{Gl^}0noGx|3nLvui=nnuJsRNtjp_)8)%Iu@G-tV*1 zF`FDZLFZaxoY44nH5m8Fc)~-kq66#vW7!~rr*-eNQL`^c6Sz$rtwc0U;+m+Tk-QX1 zxJPeM?y3B~sN?vBGLr1L#4$?@-9xWV&@q?1N;vnU1JR*l^dtsk++-8L<+HO*?HzRD zIYY6_hyr_(>@<7ko7u3E5V2*@PKS>H!AX_fWo{AsmRd@uzVfpQHaDKnj}J literal 0 HcmV?d00001 diff --git a/java/java-tests/testData/libResolve/methodHierarchy/MessageLite.class b/java/java-tests/testData/libResolve/methodHierarchy/MessageLite.class new file mode 100644 index 0000000000000000000000000000000000000000..9d3fe70dda17829cff8d5819ef770f123890a843 GIT binary patch literal 817 zcmah{T~8B16g?Me*Osa+h>9PegoG_5ZhS5wu_#HCnwl)}#iyZr-3;08G_$ip{b@e< z1N>2jy9=$26nU7rx%ZxPKhDhWKR)v=rks5-%|50MmQ^1ocGqM38CV*zjg^5e*a8;SAjOc z4NaP*lpi?JBk3Cznzm9tzgB*>{r)Y@=Vsoy<`h!M6w{}xhbFf}KGuoo(wxJ;EoLHY zEqcE>n2^fh6P3on;Pi}#j^N)x8rWI?-8-Puu?cHak$QvKN2wABOLCUwgVrkY^>AOj zns^nlb&0H?Ar9dI9!lhqWR}nrzlGH@zJ|x8^|1aA^U00KQ#>oN8-