Unused symbol: Why are Injections not marked as unused?

Hi,

we use IntelliJ inspections a lot and found them to be very reliable.

One inspection that we do not understand is the "Unused Declarations" - this inspection does not show injected declarations (e.g. @EJB) as unused.
Why is that so (it does not seem to be configurable in this regard).

In our case, all of these injections are indeed unwanted and we have not found a case where it is necessary to keep these declarations.
To us, it would be very useful to also show inejcted declarations as unused.

Hope someone can enlighten me :-)

Thanks,
Carsten

3 comments
Comment actions Permalink

Thanks for the advice, but unfortunately this did not help.

Unused @EJB injections are still not marked as unused. As soon as I strip out the annotation, IntelliJ says that it is not used.

I had a look at the source code for the unused symbol inspection at
http://grepcode.com/file/repository.grepcode.com/java/ext/com.jetbrains/intellij-idea/9.0.4/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspection.java

There on line 51, ejb annotations are hard-coded to not trigger this inspection.
Why is that so? Because it seems to me to be very deliberate and not configurable.
I simply don't understand...

Thanks a lot for your help!
Carsten

0
Comment actions Permalink

This code is old and does not reflect the current state of things. But it looks like there is no setting to exclude EJB annotatated beans from entry points for the inspection. I've created corresponding YouTrack request, please provide your feedback and vote for http://youtrack.jetbrains.com/issue/IDEA-121612 .

0

Please sign in to leave a comment.