Community
Participate
Working Groups
Build ID: I20070503-1400 Steps To Reproduce: 1. Create CompilationUnit with sourcecode: public class MyClass { void method_one(){} void method_two(){} ^-marker-^ } and set a Marker that subtypes textmarker to mark the name of the second method. I.E. set its Attributes CHAR_START = 56 and CHAR_END = 65 2. Use refactoring to rename "method_one" to "method_1". The File is not saved and the marker position is moved correctly to public class MyClass { void method_1(){} void method_two(){} ^-marker-^ } CHAR_START = 54. 3. Now use refactoring to rename the Class from "MyClass" to "MyRenamedClass". During refactoring the file is saved. Afterwards it looks like this: public class MyRenamedClass { void method_1(){} void method_two(){} ^-marker-^ } CHAR_START = 56. The Marker is set to the last position that was persisted by the MarkerUpdater. More information: I discovered this behavour in Eclipse 3.2.2 M20070212-1330. In this build, the refactoring to rename the method also saved the file, but this doesn't happen anymore. During this save the MarkerUpdater was not called to persist the new position. In the example above, saving the file after renaming the method results in starting at Position 54 instead of 56 after renaming the class. I assume, saving the file while renaming the Class is necessary because of renaming the .java file. I would think, that calling the MarkerUpdater during the class renaming could solve the problem.
reproduced in 20070515 - create 'MyClass' from comment 0 - create bookmark on method_two - rename 'MyClass' in the package Explorer to MyClassXXXXX - the bookmark location is wrong It has to do with the rename of the compilation unit. The code that renames is in jdt.core: CopyResourceElementsOperation.saveContent(PackageFragment, String, ASTRewrite, String, IFile) My guess is that the destCU.save doesn't make it to the ResourceMarkerAnnotationModel. It seems to me that the ResourceMarkerAnnotationModel should also listen for moves and update the markers before this happens. (wild guess) We need to make sure that the
Martin, some text seems to be missing from your last comment.
The last sentence should have been deleted. Please ignore.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.