'Unused Symbol' inspection triggering incorrectly?

In recent builds I've noticed parameters in public and protected methods
have started going grey if they aren't used in the method. This didn't
used to happen, as there is always the possibility that they could
simply be api parameters, which other methods would use upon override,
so they were implicitly 'used'. So this appears to be a bug.

Investigating further, if I edit the inspection settings via the
intention menu triggered by the grey parameter, I am taken to 'Unused
symbol' rather than 'Unused method parameters' (I have the former
enabled, the latter not). In the description of 'Unused symbol'
inspection, it says 'Detects local variables and private members that
are declared but not used', but this says nothing about method
parameters. So maybe this inspection is being triggered for method
parameters incorrectly, treating them as local variables?

Cheers,
N.

7 comments
Comment actions Permalink

there are a few more problems with the inspections. idea shows errors (could not resolve xy), but there are none

0
Comment actions Permalink

Hello Nathan,

In recent builds I've noticed parameters in public and protected methods
have started going grey if they aren't used in the method. This didn't
used to happen, as there is always the possibility that they could
simply be api parameters, which other methods would use upon override,
so they were implicitly 'used'. So this appears to be a bug.


I'm seeing this as well, although I thought it was a deliberate change. Anyway, it starts to really
annoy me, so there should at least be an option.

Investigating further, if I edit the inspection settings via the
intention menu triggered by the grey parameter, I am taken to 'Unused
symbol' rather than 'Unused method parameters' (I have the former
enabled, the latter not). In the description of 'Unused symbol'
inspection, it says 'Detects local variables and private members that
are declared but not used', but this says nothing about method
parameters. So maybe this inspection is being triggered for method
parameters incorrectly, treating them as local variables?


"Unused Method Parameter" is an inspection you can run via "Analyze -> Inspect Code" that takes the
whole project-scope into account. "Unused Symbol" is the one that is responsible for the on-the-fly
highlighting of any symbol in the editor. It also has options for the different kinds of symbols it
can check for.

Sascha

0
Comment actions Permalink

HamsterofDeath wrote:

there are a few more problems with the inspections. idea shows errors (could not resolve xy), but there are none


There are sporadic errors though where certain constructor signatures cannot be resolved, although
this can be "fixed" by closing and reopening the project.

In case you refer to something else, you're probably better off providing a complete example that
reproduces the issue.

Sascha

0
Comment actions Permalink

Sascha Weinreuter wrote:
>> In recent builds I've noticed parameters in public and protected methods
>> have started going grey if they aren't used in the method. This didn't
>> used to happen, as there is always the possibility that they could
>> simply be api parameters, which other methods would use upon override,
>> so they were implicitly 'used'. So this appears to be a bug.


I'm seeing this as well, although I thought it was a deliberate change. Anyway, it starts to really
annoy me, so there should at least be an option.


Good, glad I'm not going mad. Pls vote for
http://www.jetbrains.net/jira/browse/IDEA-14418

Cheers,
N.

0
Comment actions Permalink

Well apparently it is not a bug it's a 'feature'. Not such a great
feature if it isn't configurable enough - we either live with the
warnings all over the place or lose the inspection completely for
parameters.

If it bothers you please vote here :
http://www.jetbrains.net/jira/browse/IDEA-14430

Cheers,
N.

Nathan Brown wrote:

Sascha Weinreuter wrote:

>>> In recent builds I've noticed parameters in public and protected methods
>>> have started going grey if they aren't used in the method. This didn't
>>> used to happen, as there is always the possibility that they could
>>> simply be api parameters, which other methods would use upon override,
>>> so they were implicitly 'used'. So this appears to be a bug.
>>
>> I'm seeing this as well, although I thought it was a deliberate
>> change. Anyway, it starts to really
>> annoy me, so there should at least be an option.


Good, glad I'm not going mad. Pls vote for
http://www.jetbrains.net/jira/browse/IDEA-14418

Cheers,
N.

0
Comment actions Permalink

i can't do that - the bug appears randomly. i open a class, it gets (re)parsed, most of the time: no problem. but sometimes, random method calls are highlighted.it seems as if idea' inspection parse intelligence agency forgot they existed, but i can still jump to the method declaration by a mouse wheel click.

0
Comment actions Permalink

HamsterofDeath wrote:

i can't do that - the bug appears randomly. i open a class, it gets (re)parsed, most of the time: no problem. but sometimes, random method calls are highlighted.it seems as if idea' inspection parse intelligence agency forgot they existed, but i can still jump to the method declaration by a mouse wheel click.


That's the issue I was referring to. There are actually plenty of JIRA entries:

http://www.jetbrains.net/jira/browse/IDEA-12968
http://www.jetbrains.net/jira/browse/IDEA-12692
http://www.jetbrains.net/jira/browse/IDEA-12245
http://www.jetbrains.net/jira/browse/IDEA-12392
http://www.jetbrains.net/jira/browse/IDEA-14083

I'm sure there are a couple more of those...

Sascha

0

Please sign in to leave a comment.