As of release 5, 'enum' is a keyword, and may not be used as an identifier

Viewed 2277

I am using enum as a parameter and I am getting this error

error: as of release 5, 'enum' is a keyword, and may not be used as an identifier

private final kotlin.jvm.functions.Function1<com.tylertech.newworld.mobility.enum.CustomAlertDialogEvents, kotlin.Unit> itemClicked = null;

Below Is my enum class

 enum class CustomAlertDialogEvents(var resId: Int, val value: Int) {
    ACTION_OPEN_SETTINGS(R.string.open, 0),
    ACTION_CLOSE_SETTINGS(R.string.close, 1)
}

And I am using like this

private val itemClicked: (CustomAlertDialogEvents) -> Unit

Any ideas why this error is coming?

UPDATE Image below shows I am using this convention and it is working for every other case. enter image description here

1 Answers

You have enum as part of your package name. enum is also a keyword in java and you cannot use keywords in package names. Rename your package e.g. to enums.

Related