Renaming a method parameter does not warn if the new name is already used by a local variable. Bug?

Hello,

I noticed that #5383 does not warn me while renaming a method parameter to a
name is already used by a local variable. Is it a bug. I believe it used to
do so before inline rename was introduced



Thank you

Alex




6 comments
Comment actions Permalink

No, this is not a bug, at least I was intentionally omitting issuing the warnings on inline rename. In case renamed local shadows the field, the field references are qualified with 'this' (since the code stays valid while changing semantics), but in case local/parameter or local/local conflict we just let the highlighting do its job to signal the error.

Eugene.

0
Comment actions Permalink

And yes, there is a situation of local variable in anonymous class, hiding local from outer class, that won't be reported as compilation error. Still I hope we have an inspection for this, that surely needs to be turned on by default:)

0
Comment actions Permalink

There is no such inspection currently, but you are quite right that one needs to exist.

--Dave Griffith

0
Comment actions Permalink

Indeed, but will you implement it, or shall I?

Bas

0
Comment actions Permalink

Your call. I've got some free time.

--Dave Griffith

0
Comment actions Permalink

Go for it then. I'm building a new bathroom in our home, so I could use the time:-)

Bas

0

Please sign in to leave a comment.