String (PsiVariable[] parameters, PsiMethod psiMethod, PsiClass containingClass, @NotNull PsiExpression qualifierExpression) { if (psiMethod.hasModifierProperty(PsiModifier.STATIC)) { return null; } final PsiMethod nonAmbiguousMethod = getNonAmbiguousReceiver(parameters, psiMethod); if (nonAmbiguousMethod == null) { return null; } final PsiClass nonAmbiguousContainingClass = nonAmbiguousMethod.getContainingClass(); if (nonAmbiguousContainingClass != null && !containingClass.equals(nonAmbiguousContainingClass)) { return getClassReferenceName(nonAmbiguousContainingClass); } if (!PsiUtil.isArrayClass(containingClass) && !PsiTypesUtil.isGetClass(psiMethod) && ExpressionUtils.isReferenceTo(qualifierExpression, ArrayUtil.getFirstElement(parameters))) { return getClassReferenceName(containingClass); } final PsiType qualifierExpressionType = qualifierExpression.getType(); if (qualifierExpressionType != null && !FunctionalInterfaceParameterizationUtil.isWildcardParameterized(qualifierExpressionType)) { try { final String canonicalText = qualifierExpressionType.getCanonicalText(); JavaPsiFacade.getElementFactory(containingClass.getProject()).createExpressionFromText(canonicalText + "::foo", qualifierExpression); return canonicalText; } catch (IncorrectOperationException ignore){} } return getClassReferenceName(containingClass); }