You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enum.valueOf shouldn't be called using an Enum.name property. Since the name of the enum variants may change over time, this might constitute a runtime-only error. This is most suspicious when a different enum's name is being used as the argument. e.g.
val model =CarModel.CIVICval make =CarMake.valueOf(model.name)
Dealing with the enum variants more directly (like switching on the enum variant) comes with more compile-time guarantees (especially in Kotlin). Conversion between enums with similar variants should happen with these switching constructs rather than depending on the similarity of enum variant names.
The text was updated successfully, but these errors were encountered:
Enum.valueOf
shouldn't be called using anEnum.name
property. Since the name of the enum variants may change over time, this might constitute a runtime-only error. This is most suspicious when a different enum's name is being used as the argument. e.g.Dealing with the enum variants more directly (like switching on the enum variant) comes with more compile-time guarantees (especially in Kotlin). Conversion between enums with similar variants should happen with these switching constructs rather than depending on the similarity of enum variant names.
The text was updated successfully, but these errors were encountered: