Idea: smart about switch statements
Doing some Groovy development using IntelliJ IDEA? You might have noticed that it will mark any fall-throughs in your switch
statements as a warning. This helpful, but it's annoying when you're doing it on purpose. But if you are doing it on purpose:
switch (item) {
case 'thing1':
doAThing()
break
case 'thing2':
anotherThing()
// intentional fall through
default:
lastThing()
If you have exactly that comment:
// intentional fall through
...as the last line of that case
then Idea won't mark it as a warning.
Written by Rob Friesel
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Groovy
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#