Unused parameter warning: where did it go?

Hi there,

If I remember correctly, IDEA used to warn me if one of the parameters
passed to a method was not used in the method's body. It was also smart
enough to not trigger that warning when the method was overwriting another
one or implementing one declared in an interface.

Where did it go? I just hope I was not dreaming, or something. :)
I'm using the 4.0 released build, btw.

Thx,
Andrei


8 comments

It shows on mine. The parameter must be declared in a final
non-inherited method (e.g. private method, constructor etc.) to be
marked as such.

N.

Andrei Oprea wrote:

Hi there,

If I remember correctly, IDEA used to warn me if one of the parameters
passed to a method was not used in the method's body. It was also smart
enough to not trigger that warning when the method was overwriting another
one or implementing one declared in an interface.

Where did it go? I just hope I was not dreaming, or something. :)
I'm using the 4.0 released build, btw.

Thx,
Andrei

0

Well, it used to work for non-final methods as well. Since IDEA knows if the
method is overwritten / overwriting another one (no O or I icons in the
gutter) it shouldn't have any problems identifying the parameter as unused.

I could bet it used to work like that.

Andrei

"Nathan Brown" <nedski@yahoo.com> wrote in message
news:c0r2n8$r6p$1@is.intellij.net...

It shows on mine. The parameter must be declared in a final
non-inherited method (e.g. private method, constructor etc.) to be
marked as such.

>

N.

>

Andrei Oprea wrote:

Hi there,

>

If I remember correctly, IDEA used to warn me if one of the parameters
passed to a method was not used in the method's body. It was also smart
enough to not trigger that warning when the method was overwriting

another

one or implementing one declared in an interface.

>

Where did it go? I just hope I was not dreaming, or something. :)
I'm using the 4.0 released build, btw.

>

Thx,
Andrei

>
>



0

Andrei Oprea wrote:

I could bet it used to work like that.

Don't be that fast to bet! It never worked that way. Though seems like we CAN actually implement it now in 4.1. 3.0 just
wasn't that fast to find out if the method is actually overriden.

--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

But if it's non final then it could be being overridden somewhere
outside your codebase, so removing it could be disastrous. The safe
rule is, if a method is non final then assume it has been overridden...
and write non-final methods carefully and deliberately!

N.

Andrei Oprea wrote:

Well, it used to work for non-final methods as well. Since IDEA knows if the
method is overwritten / overwriting another one (no O or I icons in the
gutter) it shouldn't have any problems identifying the parameter as unused.

I could bet it used to work like that.

Andrei

"Nathan Brown" <nedski@yahoo.com> wrote in message
news:c0r2n8$r6p$1@is.intellij.net...

>>It shows on mine. The parameter must be declared in a final
>>non-inherited method (e.g. private method, constructor etc.) to be
>>marked as such.
>>
>>N.
>>
>>Andrei Oprea wrote:
>>
>>>Hi there,
>>>
>>>If I remember correctly, IDEA used to warn me if one of the parameters
>>>passed to a method was not used in the method's body. It was also smart
>>>enough to not trigger that warning when the method was overwriting


another

>>>one or implementing one declared in an interface.
>>>
>>>Where did it go? I just hope I was not dreaming, or something. :)
>>>I'm using the 4.0 released build, btw.
>>>
>>>Thx,
>>>Andrei
>>>
>>>


0

private methods are by definition final and non-inherited :)

N.

Marcus Brito wrote:

Or be a private method :)

0


"Nathan Brown" <nedski@yahoo.com> wrote in message
news:c0r55o$r6p$2@is.intellij.net...

But if it's non final then it could be being overridden somewhere
outside your codebase, so removing it could be disastrous. The safe
rule is, if a method is non final then assume it has been overridden...
and write non-final methods carefully and deliberately!

>

Thinking like that one would conclude that no refactoring is safe to be
done, since there can be usages outside the codebase that cannot be taken
into account. Would you stop renaming methods or change their signatures
just because someone outside your codebase might have used them?

This is nothing more than a suggested change method signature refactoring, a
safe delete for a parameter with the result staring you in the face, before
attempting to do the actual search. :)

Andrei


0

I could bet it used to work like that.

Don't be that fast to bet! It never worked that way. Though seems like we

CAN actually implement it now in 4.1. 3.0 just

wasn't that fast to find out if the method is actually overriden.


I wasn't talking about Ariadna, it's been so long since I used it last time
that I wouldn't even dare to guess what features it had. :)
I must have confused it with the offline inspection reporting the unused
parameter.

And it would be great if you could make that an online one.
http://www.intellij.net/tracker/idea/viewSCR?publicId=29842

Thx,
Andrei


0

Please sign in to leave a comment.