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
请先登录再写评论。
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.
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:)
There is no such inspection currently, but you are quite right that one needs to exist.
--Dave Griffith
Indeed, but will you implement it, or shall I?
Bas
Your call. I've got some free time.
--Dave Griffith
Go for it then. I'm building a new bathroom in our home, so I could use the time:-)
Bas