boolean (PsiElement place, PsiClass containingClass, PsiModifierListOwner member) { if (containingClass == null) return false; //members from java.lang.Class can be invoked without ".class" final String qname = containingClass.getQualifiedName(); if (qname != null && qname.startsWith("java.")) { if (CommonClassNames.JAVA_LANG_OBJECT.equals(qname)) { //special check for toString(). Only Class.toString() should be resolved here return !(member instanceof PsiMethod && "toString".equals(((PsiMethod)member).getName())); } else if (CommonClassNames.JAVA_LANG_CLASS.equals(qname)) { return true; } if (containingClass.isInterface()) { PsiClass javaLangClass = JavaPsiFacade.getInstance(place.getProject()).findClass(CommonClassNames.JAVA_LANG_CLASS, place.getResolveScope()); if (javaLangClass != null && javaLangClass.isInheritor(containingClass, true)) { return true; } } } return false; }