diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/AnnotationRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/AnnotationRule.kt index e5f2d11ef7..cdc892f1dc 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/AnnotationRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/pinterest/ktlint/ruleset/standard/AnnotationRule.kt @@ -31,7 +31,9 @@ class AnnotationRule : Rule("annotation") { root.children() .mapNotNull { it.psi as? KtAnnotationEntry } .toList() - check(!annotations.isEmpty()) { "Annotations list should not be empty" } + if (annotations.isEmpty()) { + return + } // Join the nodes that immediately follow the annotations (whitespace), then add the final whitespace // if it's not a child of root. This happens when a new line separates the annotations from the annotated