Rename refactoring wrinkle in non-java files

When refactoring, is it appropriate for variable name renaming to look into non-java files? Some people here at work have shot themselves in the foot with that default behavior by, for example, refactor renaming a class called Identity to AbstractIdentity and having all their sql files with 'identity' columns also changed as a result. This only happens when there is a variable 'identity' representing an instance of Identity. I'm thinking about submitting this as an issue. I'm still not sure in a case like this if one should submit a feedback issue or post here...recommendations?

Thanks,
Jon

8 comments
Comment actions Permalink

Definitely this needs a request to JIRA.
Eugene.

"Jon Steelman" <no_mail@jetbrains.com> wrote in message
news:20291168.1112797923936.JavaMail.itn@is.intellij.net...

When refactoring, is it appropriate for variable name renaming to look

into non-java files? Some people here at work have shot themselves in the
foot with that default behavior by, for example, refactor renaming a class
called Identity to AbstractIdentity and having all their sql files with
'identity' columns also changed as a result. This only happens when there is
a variable 'identity' representing an instance of Identity. I'm thinking
about submitting this as an issue. I'm still not sure in a case like this if
one should submit a feedback issue or post here...recommendations?
>

Thanks,
Jon



0
Comment actions Permalink

I get this sometimes with spring injected properties as well...

--peter

0
Comment actions Permalink

Well, it turned out to be not so obvious:
First of all in 4.5 we had a problem with correctly determining the use
scope of e.g. variables,
so if you wanted to rename say local variable, some identifiers in sql could
have been indeed renamed, that was fixed in recent Irida builds as a result
of PsiElement.getUseScope() refactoring.
On the other hand, if you are to rename say public field, then you could
perfectly reference this field from some alien language and also write a
comment for this reference - thus I think we are perfectly legitimate to
change it.
The good news is that if you follow some java coding style convention, e.g.
prefixing all fields with 'my' or something else, then it is unlikely that
this identifier will be renamed accidentally.
And for local variables, as I already mentioned, the problem has been
resolved.

Friendly,
Eugene.

"Jon Steelman" <no_mail@jetbrains.com> wrote in message
news:20291168.1112797923936.JavaMail.itn@is.intellij.net...

When refactoring, is it appropriate for variable name renaming to look

into non-java files? Some people here at work have shot themselves in the
foot with that default behavior by, for example, refactor renaming a class
called Identity to AbstractIdentity and having all their sql files with
'identity' columns also changed as a result. This only happens when there is
a variable 'identity' representing an instance of Identity. I'm thinking
about submitting this as an issue. I'm still not sure in a case like this if
one should submit a feedback issue or post here...recommendations?
>

Thanks,
Jon



0
Comment actions Permalink

If you ask me, I would rather have to rename these foreign language references manually, than to accidentaly replace a common variable name in all documents in my project.

0
Comment actions Permalink

Well, we just suggest references in preview, you approve.
Eugene.

"Marcus Brito" <mbrito@gmail.com> wrote in message
news:18625164.1113143508512.JavaMail.itn@is.intellij.net...

If you ask me, I would rather have to rename these foreign language

references manually, than to accidentaly replace a common variable name in
all documents in my project.


0
Comment actions Permalink

True, but wouldn't it be better for these in particular to be excluded by default in non-java files?

Jon

0
Comment actions Permalink

You propose a rather pessimistic approach. With local variables use scope
corrected, I need more use cases when you can shoot yourself in the foot.
Also aside from our discussion, I'm thinking of excluded usages filter in
usage view. Would be useful in refactorings preview IMHO. Your opinion?

Friendly,
Eugene.

"Jon Steelman" <no_mail@jetbrains.com> wrote in message
news:16411895.1113228034122.JavaMail.itn@is.intellij.net...

True, but wouldn't it be better for these in particular to be excluded by

default in non-java files?
>

Jon



0

Please sign in to leave a comment.