KT.USE_ARRAY_LITERALS_IN_ANNOTATIONS

Annotation uses the 'arrayOf(...)' syntax instead of the array literal '[...]' syntax

This rule detects annotations which use the arrayOf(...) syntax instead of the array literal [...] syntax. The latter should be preferred as it is more readable.

Noncompliant Code

Copy
@PositiveCase(arrayOf("..."))

Compliant Code

Copy
@NegativeCase(["..."])

The content on this page is adapted from the Detekt Docs. Copyright ©2022 The Detekt Team. All rights reserved. https://detekt.dev/comments.html