private static boolean isApplicableToDeclaration(PsiAnnotation annotation, PsiModifierList list) {
    PsiAnnotation.TargetType[] allTargets = AnnotationTargetUtil.getTargetsForLocation(list);
    if (allTargets.length == 0) return true;

    PsiAnnotation.TargetType[] nonTypeUse = Stream
      .of(allTargets)
      .filter(t -> t != PsiAnnotation.TargetType.TYPE_USE)
      .toArray(PsiAnnotation.TargetType[]::new);
    return AnnotationTargetUtil.findAnnotationTarget(annotation, nonTypeUse) != null;
  }
private static boolean isApplicableToDeclaration(PsiAnnotation annotation, PsiModifierList list)