Kotlin Enum class entry name doesn't match regex - Android Studio

Viewed 312

Working on an Android app in Kotlin. I've created this Enum class that isn't in use yet, so all of the entries are greyed out with 'never used' warnings. There is one entry Decay_Red that has purple text and the warning:

Enum entry name 'Decay_Red' doesn't match regex [A-Z]([A-Za-z\d]*|[A-Z_\d]*)

This seems like some weird bug to me. Does anybody know why this is occurring?

It's just a warning, but I'd like to get to the bottom of it.

Code

enum class TBParameterType {

    Decay_Blue,

    Decay_Green,

    // this one doesn't match regex
    Decay_Red
}
1 Answers

Probably it's an inspection that verifies naming conventions.

Here, it tells you that the name of the enum values should either be camel case without underscores, or use only capital letters and underscores. I guess if you remove the problematic constant, it will highlight another one. To avoid the warning you can rename the values to match the convention.

Related