private @NotNull JavaResolveResult doAdvancedResolve(@NotNull PsiFile containingFile) {
    PsiElement psiElement = getElement();

    if (!psiElement.isValid()) return JavaResolveResult.EMPTY;

    String elementText = psiElement.getText();

    PsiElement context = getContext();
    if (context instanceof PsiClass) {
      if (isStaticClassReference(elementText, false)) {
        PsiClass psiClass = ((PsiClass)context).findInnerClassByName(getCanonicalText(), false);
        if (psiClass != null) {
          return new ClassCandidateInfo(psiClass, PsiSubstitutor.EMPTY, false, psiElement);
        }
        PsiElement member = doResolveMember((PsiClass)context, myText);
        return member == null ? JavaResolveResult.EMPTY : new CandidateInfo(member, PsiSubstitutor.EMPTY, false, false, psiElement);
      }
      if (!myInStaticImport && myJavaClassReferenceSet.isAllowDollarInNames()) {
        return JavaResolveResult.EMPTY;
      }
    }

    TextRange rangeInElement = getRangeInElement();
    int endOffset = rangeInElement.getEndOffset();
    if (endOffset > elementText.length()) {
      LOG.error(elementText+": rangeInElement="+rangeInElement+"; "+getClass());
    }
    int startOffset = myJavaClassReferenceSet.getReference(0).getRangeInElement().getStartOffset();
    String qName = elementText.substring(startOffset, endOffset);
    if (!qName.contains(".")) {
      JavaResolveResult viaImports = JBIterable.from(JavaClassReferenceProvider.IMPORTS.getValue(getOptions()))
        .map(o -> o == null ? JavaResolveResult.EMPTY : advancedResolveInner(psiElement, o + "." + qName, containingFile))
        .find(o -> o != JavaResolveResult.EMPTY);
      if (viaImports != null) {
        return viaImports;
      }
    }
    return advancedResolveInner(psiElement, qName, containingFile);
  }
private @NotNull JavaResolveResult doAdvancedResolve(@NotNull PsiFile containingFile)