private static @Nullable VariableKind getKind(@NotNull PsiReferenceExpression refExpr) {
    JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(refExpr.getProject());
    String reference = refExpr.getText();

    if (StringUtil.isUpperCase(reference)) {
      return VariableKind.STATIC_FINAL_FIELD;
    }

    for (VariableKind kind : VariableKind.values()) {
      String prefix = styleManager.getPrefixByVariableKind(kind);
      String suffix = styleManager.getSuffixByVariableKind(kind);

      if (prefix.isEmpty() && suffix.isEmpty()) {
        continue;
      }

      if (reference.startsWith(prefix) && reference.endsWith(suffix)) {
        return kind;
      }
    }

    if (StringUtil.isCapitalized(reference)) {
      return null;
    }

    return VariableKind.LOCAL_VARIABLE;
  }
private static @Nullable VariableKind getKind(@NotNull PsiReferenceExpression refExpr)