Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 693
sandeep dhami Avatar asked Sep 02 '25 16:09

sandeep dhami


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.

like image 160
laalto Avatar answered Sep 04 '25 08:09

laalto