Is it possible to add inspection settings for "forbidden" methods?
For example I want to add String.getBytes() (no args) as a "forbidden" method so it gives an error (or at least a warning), is this possible in Idea 13 (and/or 14)?
Please sign in to leave a comment.
You can do this using the "Structural Search Inspection".
Now any call's on the no parameters version of getBytes() on a variable of type String will be highlighted (as defined by the sevierity level you selected for the inspection).
If you also want a quick fix modify the code (i.e. to automatically add the call to a Charset), you can do that as well. Follow the above instructions with the following modifications:
Now when you get the warning, you will have a quick fix option available via Alt+Enter to change it to a call with a Charset defined.
Thanks it worked like a charm!
I have never use the Structural Search before but it is very powerfull :)