public static boolean isDeprecated(@NotNull JetModifierListOwner owner) { JetModifierList modifierList = owner.getModifierList(); if (modifierList != null) { List<JetAnnotationEntry> annotationEntries = modifierList.getAnnotationEntries(); for (JetAnnotationEntry annotation : annotationEntries) { Name shortName = getShortName(annotation); if (KotlinBuiltIns.getInstance().getDeprecatedAnnotation().getName().equals(shortName)) { return true; } } } return false; }
@Nullable public static JetModifierList replaceModifierList( @NotNull JetModifierListOwner owner, @Nullable JetModifierList modifierList) { JetModifierList oldModifierList = owner.getModifierList(); if (modifierList == null) { if (oldModifierList != null) oldModifierList.delete(); return null; } else { if (oldModifierList == null) { PsiElement firstChild = owner.getFirstChild(); return (JetModifierList) owner.addBefore(modifierList, firstChild); } else { return (JetModifierList) oldModifierList.replace(modifierList); } } }