Prevent double calculation of containing class
[idea/community.git] / java / openapi / src / com / intellij / psi / util / PsiUtil.java
index d1536fd35e737ddcc729bd1150ff0ffdde657212..b2a81ac5f96543171ff10a82d5d86025c9407600 100644 (file)
@@ -688,12 +688,13 @@ public final class PsiUtil extends PsiUtilBase {
         myNextObtained = true;
         return;
       }
-      if (myCurrentOwner.hasModifierProperty(PsiModifier.STATIC) || myCurrentOwner.getContainingClass() == null) {
+      final PsiClass containingClass = myCurrentOwner.getContainingClass();
+      if (myCurrentOwner.hasModifierProperty(PsiModifier.STATIC) || containingClass == null) {
         myNext = null;
         myNextObtained = true;
         return;
       }
-      myCurrentOwner = myCurrentOwner.getContainingClass();
+      myCurrentOwner = containingClass;
       obtainCurrentParams(myCurrentOwner);
       nextElement();
     }