private @Nullable RefJavaElement refineElement(RefEntity refEntity) {
    if (myIsShallowAnalysis) return null;
    if (!(refEntity instanceof RefJavaElement refElement)) return null; // dead code doesn't work with refModule | refPackage
    RefFilter filter = getFilter();
    if (!filter.accepts(refElement)) return null;
    RefJavaElement refinedElement = (RefJavaElement)getRefManager().getRefinedElement(refEntity);
    if (refinedElement != refEntity && filter.accepts(refinedElement)) return null; // prevent duplicate reporting
    if (!refinedElement.isValid()) return null;
    if (!compareVisibilities(refinedElement, getTool().getSharedLocalInspectionTool())) return null;
    if (isSuppressed(refinedElement) || refinedElement.isSuppressed(SUPPRESSIONS)) return null;
    if (!ApplicationManager.getApplication().isHeadlessEnvironment() & getContext().getUIOptions().FILTER_RESOLVED_ITEMS &&
        (myFixedElements.containsKey(refinedElement) || isExcluded(refinedElement))) {
      return null;
    }
    if (skipEntryPoints(refinedElement)) return null;
    return refinedElement;
  }
private @Nullable RefJavaElement refineElement(RefEntity refEntity)