unused parameters not flagged anymore?

I have some methods which have unused parameters. Didn't IDEA use to
mark those parameters in the editor? On my system I can now only find
the unused parameters by running an inspection. Is this some setting I
have disabled or is it a change/bug in IDEA?

-- Bas

3 comments

Bas Leijdekkers wrote:

I have some methods which have unused parameters. Didn't IDEA use to
mark those parameters in the editor? On my system I can now only find
the unused parameters by running an inspection. Is this some setting I
have disabled or is it a change/bug in IDEA?


If the method is not private, final or static, it can be overridden in
other classes and the parameters might be used there. I don't think
IDEA performs this kind of global analysis in the editor highlighting
engine, only when you run an inspection. Maybe that's the reason?

0

On 2003/10/27 16:22, Jonas Kvarnström wrote:

Bas Leijdekkers wrote:

>> I have some methods which have unused parameters. Didn't IDEA use to
>> mark those parameters in the editor? On my system I can now only find
>> the unused parameters by running an inspection. Is this some setting I
>> have disabled or is it a change/bug in IDEA?


If the method is not private, final or static, it can be overridden in
other classes and the parameters might be used there. I don't think
IDEA performs this kind of global analysis in the editor highlighting
engine, only when you run an inspection. Maybe that's the reason?


Aha, that's probably it. The method in question is final though, but
when I make private or static it works as you say. Thanks for the info!

0

Bas Leijdekkers wrote:

Aha, that's probably it. The method in question is final though, but
when I make private or static it works as you say. Thanks for the info!


Oops, I shouldn't have included "final" in the list: Even if it's final
it could be overriding an existing method so it could still be a member
of an inheritance hierarchy.

I guess IDEA does know whether there actually are other methods
overriding or overridden by this implementation, since it knows whether
to place those little "o-with-up-arrow" or "o-with-down-arrow" icons in
the left gutter. That would mean that you could theoretically check for
unused parameters in all cases where there is no overriding or
overridden version of the method. On the other hand this might give you
false positives if you're writing some kind of framework meant to be
extended by others.

0

Please sign in to leave a comment.