Skip to content

Commit

Permalink
Fix AnnotationRule exception
Browse files Browse the repository at this point in the history
* Return if there's no annotations found instead of throwing an exception
* Fies pinterest#490
  • Loading branch information
shashachu committed Jul 3, 2019
1 parent 0fef759 commit 6a71b77
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a71b77

Please # to comment.