Intellij IDEA 13: how do I disable refactor comments and strings?

And is there any reason why this is on by default??

Yes, there is. People tend to use way too many DSLs, templates and language injections these days. In plain old Java all these things mainly exist as Strings. Reflection API also represents method/class name as a String. It is not possible for any IDE to support and recognize them all, so it does it's best to provide you with a safety net against possible refactoring mistakes. If you have an excellent unit test coverage, though, then you're probably safe here.

As for comments, they often contain code samples. These code chunks become obsolete quickly during renamings, so it's helpful when IDE reminds you about their existence.

This check, of course, results in false positives sometimes. However, if you're giving your variables descriptive self-explanatory names (I mean not "var" or "val"), this is unlikely to happen. So, IDE is pushing you towards a better code style in some way.

If you're still not convinced, then follow an advice by @Meo and disable the search in strings and comments.


When you press Shift + F6 (Refactor Rename) twice, it opens the dialog and you can disable "Search in comments and strings"