private HighlightInfo.Builder checkReferenceImpl(@NotNull GrReferenceElement<?> ref) {
    boolean isCompileStatic = CompileStaticUtil.isCompileStatic(ref);

    if (!needToCheck(ref, isCompileStatic)) return null;

    PsiElement parent = ref.getParent();
    if (parent instanceof GrConstructorCall) {
      Pair<@DetailedDescription String, GroovyResolveResult> constructorError = checkConstructorCall((GrConstructorCall)parent);
      if (constructorError != null) {
        Pair<HighlightInfo.Builder,HighlightSeverity> info = createAnnotationForRef(ref, isCompileStatic, constructorError.first);
        registerFixes(ref, constructorError.second, info.getFirst(), info.getSecond());
        return info.getFirst();
      }
    }

    GroovyResolveResult[] results = ref.multiResolve(false);
    boolean hasInaccessibleResults = ContainerUtil.or(results, GrAccessibilityChecker::checkResolveResult);
    if (hasInaccessibleResults) {
      String error = GroovyBundle.message("cannot.access", ref.getReferenceName());
      Pair<HighlightInfo.Builder,HighlightSeverity> info = createAnnotationForRef(ref, isCompileStatic, error);
      if (results.length == 1) {
        registerFixes(ref, results[0], info.getFirst(), info.getSecond());
      }
      return info.getFirst();
    }

    return null;
  }
private HighlightInfo.Builder checkReferenceImpl(@NotNull GrReferenceElement<?> ref)