Eclipse: “Refactor - Rename” completely messed up, replacing arbitrary characters in file

前端 未结 3 747
南方客
南方客 2021-01-14 22:36

When refactoring a class name, Eclipse lately shows a very strange behavior. For example, let\'s look at one of our classes:

public class CampaignCSVPanel ex         


        
相关标签:
3条回答
  • 2021-01-14 23:19

    I found the problem: The project is using svn tags like $Date: $ When I remove them, the problem disappears. When I re-insert them manually (to make sure I don't insert invalid characters), the problem re-appears.

    I experimented a little more, and the problem also disappears, when I switch the SVN connector from JavaHL to SVNKit.

    0 讨论(0)
  • 2021-01-14 23:28

    Try this:

    Go to Windows -> Preferences -> Java and uncheck 'Rename in editor without dialogue'

    (I'm looking at the recent release of Eclipse Indigo, I only assume the settings are the same on previous versions)

    Now you can preview all of the changes it intends to make.

    If you can do this and verify in that dialogue that it is doing some crazy replacements, then you should most definitely file a bug with Eclipse and provide the reproducible example. I would bet though, that once you look at the list of things it intends to replace you'll find some other explanation for the problem.

    0 讨论(0)
  • 2021-01-14 23:36

    That's annoying. Obviously the refactoring engine knows that it has to replace something but replaces characters at a wrong position... - no answer but some additional ideas/tests

    1. Looks like you check out complete projects. Try to import sources only to a fresh project to check if the problem still occurs or if its gone.
    2. If project metadata has been checked in (it shouldn't, but we never know), clean the project right after checking the project out.
    3. Check the character encoding of that companies source files. Maybe there's some sort of mismatch which causes the editor to replace on wrong positions. And double check the source files for strange unprintable ascii bytes... again, we never know...
    0 讨论(0)
提交回复
热议问题