Structural search question
Hi all,
I'm trying to find instances of bad usages of logging in our code, for example: log.error(exception). This seems like a good application for structural search, but for the life of me I can't figure it out. I need to do something like:
.error(]]>)
Is this possible? For bonus points, can the same search find calls to debug, info, warn and fatal at the same time? Obviously that's just laziness though :)
As an aside, this seems like a good candidate for an inspection (log parameter calls default toString of exception type?)
Cheers,
Colin
Please sign in to leave a comment.
Hi,
$instance$.error($parameter$);
instance variable has expression type constraint of 'org.log4j.Category'
within hierarchy
parameter has expression type constraint of 'java.lang.Exception' within
hierarchy
Colin Fleming wrote:
--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"
That's great, thanks very much, Maxim.
I seem to recall seeing a plan a while ago to allow user-defined inspections using the structural search - did anything ever come of that?
Cheers,
Colin
Take a look at the "Structural Search Inspection"
I love being amazed from time to time :)
Cheers,
Colin