private static PsiAnnotation[] getAnnotations(@NotNull final PsiModifierListOwner listOwner, final boolean inHierarchy) {
    final PsiModifierList modifierList = listOwner.getModifierList();
    if (!inHierarchy) {
      return modifierList == null ? PsiAnnotation.EMPTY_ARRAY : modifierList.getAnnotations();
    }
    return CachedValuesManager.getCachedValue(listOwner, () -> CachedValueProvider.Result
      .create(getHierarchyAnnotations(listOwner), PsiModificationTracker.MODIFICATION_COUNT));
  }
private static PsiAnnotation[] getAnnotations(@NotNull final PsiModifierListOwner listOwner, final boolean inHierarchy)