List<String> (PsiModifierList modifierList) { final List<String> modifiers = new SmartList<>(); final List<String> typeAnnotations = new SmartList<>(); final List<String> annotations = new SmartList<>(); for (PsiElement child : modifierList.getChildren()) { if (child instanceof PsiJavaToken) { modifiers.add(child.getText()); } else if (child instanceof PsiAnnotation annotation) { if (PsiImplUtil.isTypeAnnotation(child) && !isMethodWithVoidReturnType(modifierList.getParent())) { final PsiAnnotation.TargetType[] targets = AnnotationTargetUtil.getTargetsForLocation(annotation.getOwner()); if (typeUseWithType || !modifiers.isEmpty() || AnnotationTargetUtil.findAnnotationTarget(annotation, targets[0]) == PsiAnnotation.TargetType.UNKNOWN) { typeAnnotations.add(child.getText()); continue; } } annotations.add(child.getText()); } } modifiers.sort(new ModifierComparator()); final List<String> result = new SmartList<>(); result.addAll(annotations); result.addAll(modifiers); result.addAll(typeAnnotations); return result; }