public VariableResolverProcessor(@NotNull PsiJavaCodeReferenceElement place, @NotNull PsiFile placeFile) { super(place.getReferenceName(), ourFilter, new PsiConflictResolver[]{new JavaVariableConflictResolver()}, new SmartList<CandidateInfo>(), place, placeFile); PsiClass access = null; PsiElement qualifier = place.getQualifier(); if (qualifier instanceof PsiExpression) { final JavaResolveResult accessClass = PsiUtil.getAccessObjectClass((PsiExpression)qualifier); final PsiElement element = accessClass.getElement(); if (element instanceof PsiTypeParameter) { PsiElementFactory factory = JavaPsiFacade.getInstance(placeFile.getProject()).getElementFactory(); final PsiClassType type = factory.createType((PsiTypeParameter)element); final PsiType accessType = accessClass.getSubstitutor().substitute(type); if (accessType instanceof PsiArrayType) { LanguageLevel languageLevel = PsiUtil.getLanguageLevel(placeFile); access = factory.getArrayClass(languageLevel); } else if (accessType instanceof PsiClassType) { access = ((PsiClassType)accessType).resolve(); } } else if (element instanceof PsiClass) { access = (PsiClass)element; } } myAccessClass = access; }
public VariableResolverProcessor(@NotNull PsiJavaCodeReferenceElement place, PsiFile placeFile) { super(place.getText(), ourFilter, new PsiConflictResolver[]{new JavaVariableConflictResolver()}, new SmartList<CandidateInfo>(), place, placeFile); PsiElement referenceName = place.getReferenceNameElement(); if (referenceName instanceof PsiIdentifier){ setName(referenceName.getText()); } PsiClass access = null; PsiElement qualifier = place.getQualifier(); if (qualifier instanceof PsiExpression) { final JavaResolveResult accessClass = PsiUtil.getAccessObjectClass((PsiExpression)qualifier); final PsiElement element = accessClass.getElement(); if (element instanceof PsiTypeParameter) { PsiElementFactory factory = JavaPsiFacade.getInstance(element.getProject()).getElementFactory(); final PsiClassType type = factory.createType((PsiTypeParameter)element); final PsiType accessType = accessClass.getSubstitutor().substitute(type); if (accessType instanceof PsiArrayType) { LanguageLevel languageLevel = PsiUtil.getLanguageLevel(qualifier); access = factory.getArrayClass(languageLevel); } else if (accessType instanceof PsiClassType) access = ((PsiClassType)accessType).resolve(); } else if (element instanceof PsiClass) access = (PsiClass)element; } myAccessClass = access; }