Skip to main content

proposal: switch (enum) should handle null arg

No replies
john2000
Offline
Joined: 2004-03-04
Points: 0

Before enums, switch (x) could never throw null exception. But now, switch (enumtype) might throw null exception when arg is null. This is annoying because you have to enclose the switch in try-catch (or define the method signature with throws ...).

I would like to let the switch default clause handle the null. This feature should be integrated with the switch (String valued arg) if that feature is accepted.