structural search - non static field declaration

Hi

I'd like to find all non-static declaration of loggers. The template below works fine to find all logger declarations...

Logger $logger$ = Logger.getLogger($param$);

...but how can I say that I only want to find the ones that are non-static. I tried without success :(

Match expected:
protected final transient Logger LOGGER = Logger.getLogger(Foo.class);

No match expected:
private static final Logger LOGGER = Logger.getLogger(Bar.class);

Any help is highly appreciated. Thanks in advance!

--Etienne

0
4 comments
Avatar
Permanently deleted user

This is not currently possible. I thought there was an issue for this in the
tracker at http://jetbrains.net/jira but I can't find it, so you should file it.

etienne wrote:

Hi

I'd like to find all non-static declaration of loggers. The template below works fine to find all logger declarations...

Logger $logger$ = Logger.getLogger($param$);

...but how can I say that I only want to find the ones that are non-static. I tried without success :(

Match expected:
protected final transient Logger LOGGER = Logger.getLogger(Foo.class);

No match expected:
private static final Logger LOGGER = Logger.getLogger(Bar.class);

Any help is highly appreciated. Thanks in advance!

--Etienne

0
Avatar
Permanently deleted user

Hello etienne,

There's already a dedicated inspection for this called 'Non-constant logger'
from 'Logging issues' category.
-


Maxim Shafirov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Hi

I'd like to find all non-static declaration of loggers. The template
below works fine to find all logger declarations...

Logger $logger$ = Logger.getLogger($param$);

..but how can I say that I only want to find the ones that are
non-static. I tried without success :(

Match expected:
protected final transient Logger LOGGER = Logger.getLogger(Foo.class);
No match expected:
private static final Logger LOGGER = Logger.getLogger(Bar.class);
Any help is highly appreciated. Thanks in advance!

--Etienne



0

Hi Maxim

Thanks for telling me! Works like a charm.

--Etienne

P.S. The support you guys provide is just great!

0
Avatar
Permanently deleted user

http://www.jetbrains.net/jira/browse/IDEADEV-2852

etienne wrote:

Hi

I'd like to find all non-static declaration of loggers. The template below works fine to find all logger declarations...

Logger $logger$ = Logger.getLogger($param$);

..but how can I say that I only want to find the ones that are non-static. I tried without success :(

Match expected:
protected final transient Logger LOGGER = Logger.getLogger(Foo.class);

No match expected:
private static final Logger LOGGER = Logger.getLogger(Bar.class);

Any help is highly appreciated. Thanks in advance!

--Etienne



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.