private static boolean hasAnnotation(PsiVariable p) {
    if (p.getAnnotations().length > 0) return true;
    PsiTypeElement typeElement = p.getTypeElement();
    return typeElement != null && !typeElement.isInferredType() && PsiTypesUtil.hasTypeAnnotation(typeElement.getType());
  }
private static boolean hasAnnotation(PsiVariable p)