void (@NotNull GrExpression qualifier) { Project project = qualifier.getProject(); final PsiType qualifierType = TypesUtil.boxPrimitiveType(qualifier.getType(), qualifier.getManager(), qualifier.getResolveScope()); final ResolveState state = ResolveState.initial(); if (qualifierType == null || PsiTypes.voidType().equals(qualifierType)) { if (qualifier instanceof GrReferenceExpression) { PsiPackage aPackage = resolvePackageFqn((GrReferenceElement<?>)qualifier); if (aPackage != null) { aPackage.processDeclarations(myProcessor, state, null, myRefExpr); return; } PsiElement resolved = ((GrReferenceExpression)qualifier).resolve(); if (resolved instanceof PsiVariable) { resolved.processDeclarations(myProcessor, state, null, myRefExpr); return; } } getVariantsFromQualifierType(TypesUtil.getJavaLangObject(qualifier), project); } else if (qualifierType instanceof PsiIntersectionType) { for (PsiType conjunct : ((PsiIntersectionType)qualifierType).getConjuncts()) { getVariantsFromQualifierType(conjunct, project); } } else if (qualifierType instanceof GrTraitType) { // Process trait type conjuncts in reversed order because last applied trait matters. PsiType[] conjuncts = ((GrTraitType)qualifierType).getConjuncts(); for (int i = conjuncts.length - 1; i >= 0; i--) { getVariantsFromQualifierType(conjuncts[i], project); } } else { getVariantsFromQualifierType(qualifierType, project); if (qualifier instanceof GrReferenceExpression && !PsiUtil.isSuperReference(qualifier) && !PsiUtil.isInstanceThisRef(qualifier)) { PsiElement resolved = ((GrReferenceExpression)qualifier).resolve(); if (resolved instanceof PsiClass) { ////omitted .class GlobalSearchScope scope = myRefExpr.getResolveScope(); PsiClass javaLangClass = PsiUtil.getJavaLangClass(resolved, scope); if (javaLangClass != null) { PsiSubstitutor substitutor = PsiSubstitutor.EMPTY; PsiTypeParameter[] typeParameters = javaLangClass.getTypeParameters(); if (typeParameters.length == 1) { substitutor = substitutor.put(typeParameters[0], qualifierType); } PsiType javaLangClassType = JavaPsiFacade.getElementFactory(myRefExpr.getProject()).createType(javaLangClass, substitutor); ResolveUtil.processAllDeclarations(javaLangClassType, myProcessor, state, myRefExpr); } } } } }