@Override
  public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement ref) {
    JavaResolveResult result = doVisitReferenceElement(ref);
    if (result != null) {
      PsiElement resolved = result.getElement();
      if (!hasErrorResults()) add(GenericsHighlightUtil.checkRawOnParameterizedType(ref, resolved));
      if (!hasErrorResults() && resolved instanceof PsiClass aClass) {
        add(HighlightUtil.checkLocalClassReferencedFromAnotherSwitchBranch(ref, aClass));
      }
      if (!hasErrorResults() && resolved instanceof PsiModifierListOwner) {
        PreviewFeatureUtil.checkPreviewFeature(ref, myPreviewFeatureVisitor);
      }
      if (!hasErrorResults()) {
        HighlightMethodUtil.checkAmbiguousConstructorCall(getProject(), ref, resolved, ref.getParent(), myJavaSdkVersion, myErrorSink);
      }
    }
  }
@Override
  public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement ref)