public static boolean treeWalkUp(final @NotNull PsiScopeProcessor processor,
                                   final @NotNull PsiElement entrance,
                                   final @Nullable PsiElement maxScope,
                                   final @NotNull ResolveState state) {
    if (!entrance.isValid()) {
      LOG.error(new PsiInvalidElementAccessException(entrance));
    }
    PsiElement prevParent = entrance;
    PsiElement scope = entrance;

    NameHint hint = processor.getHint(NameHint.KEY);
    String name = hint == null ? null : hint.getName(state);

    while (scope != null) {
      ProgressIndicatorProvider.checkCanceled();
      if (scope instanceof PsiClass) {
        processor.handleEvent(JavaScopeProcessorEvent.SET_CURRENT_FILE_CONTEXT, scope);
      }
      if (!scope.processDeclarations(processor, state, prevParent, entrance)) {
        return false; // resolved
      }

      if (scope == maxScope) break;
      prevParent = scope;
      processor.handleEvent(JavaScopeProcessorEvent.EXIT_LEVEL, scope);
      processor.handleEvent(JavaScopeProcessorEvent.CHANGE_LEVEL, null);
      scope = scope instanceof PsiClassImpl ? ((PsiClassImpl)scope).getContext(name) : scope.getContext();
    }

    return true;
  }
public static boolean treeWalkUp(final @NotNull PsiScopeProcessor processor,
                                   final @NotNull PsiElement entrance,
                                   final @Nullable PsiElement maxScope,
                                   final @NotNull ResolveState state)