boolean (@NotNull PsiModifierListOwner member, PsiElement place, boolean filterStaticAfterInstanceQualifier, GrExpression qualifier, PsiClass containingClass) { final boolean isStatic = member.hasModifierProperty(PsiModifier.STATIC); if (qualifier instanceof GrReferenceExpression) { if ("class".equals(((GrReferenceExpression)qualifier).getReferenceName())) { //invoke static members of class from A.class.foo() final PsiType type = qualifier.getType(); if (type instanceof PsiClassType) { final PsiClass psiClass = ((PsiClassType)type).resolve(); if (psiClass != null && CommonClassNames.JAVA_LANG_CLASS.equals(psiClass.getQualifiedName())) { final PsiType[] params = ((PsiClassType)type).getParameters(); if (params.length == 1 && params[0] instanceof PsiClassType) { if (place.getManager().areElementsEquivalent(containingClass, ((PsiClassType)params[0]).resolve())) { return member.hasModifierProperty(PsiModifier.STATIC); } } } } } else if (PsiUtil.isThisOrSuperRef(qualifier)) { //static members may be invoked from this.<...> final boolean isInStatic = isInStaticContext(qualifier); if (PsiUtil.isThisReference(qualifier) && isInStatic) { return checkJavaLangClassMember(place, containingClass, member) || member.hasModifierProperty(PsiModifier.STATIC); } return !isStatic || !filterStaticAfterInstanceQualifier; } PsiElement qualifierResolved = ((GrReferenceExpression)qualifier).resolve(); if (qualifierResolved instanceof PsiClass || qualifierResolved instanceof PsiPackage) { //static context if (member instanceof PsiClass) { return true; } if (isStatic) { return true; } //non-physical method, e.g. gdk return containingClass != null && checkJavaLangClassMember(place, containingClass, member); } } //instance context if (member instanceof PsiClass) { return false; } return !isStatic || !filterStaticAfterInstanceQualifier; }