Java 类com.intellij.psi.scope.conflictResolvers.JavaVariableConflictResolver 实例源码

项目:intellij-ce-playground    文件:VariableResolverProcessor.java   
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;
}
项目:tools-idea    文件:VariableResolverProcessor.java   
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;
}
项目:consulo-java    文件:VariableResolverProcessor.java   
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;
}