Bug 16751 - Renaming a class doesn't update all references
Summary: Renaming a class doesn't update all references
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 2.0 F2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-22 07:51 EDT by Ilja Preuss CLA
Modified: 2002-06-03 14:30 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ilja Preuss CLA 2002-05-22 07:51:48 EDT
class SuperClass {
  public static final String CONSTANT = "value";
}

class SubClass extends SuperClass {
}

class Test {
  public static void main(String[] arguments) {
    System.out.println(SubClass.CONSTANT);
  }
}

Use Refactor/Rename Element... to rename SubClass. The reference in Test is not 
updated, causing a compile time error.
Comment 1 Adam Kiezun CLA 2002-05-22 08:37:36 EDT
jcore search problem - the reference in Test is not found.
it is major.
tested on F1
Comment 2 Jerome Lanneluc CLA 2002-05-22 11:32:27 EDT
Good find! The type reference pattern was using the declaring class of the 
field binding of the qualified name reference instead of the actual receiver 
type binding.

Fixed (and thanks for the test case)
Comment 3 Adam Kiezun CLA 2002-05-27 08:41:00 EDT
reopening
the end position of the match is incorrect (it includes the .CONSTANT as well)
consider the following:

class SuperClass {
  public static final String CONSTANT = "value";
}

class SubClass extends SuperClass {
}

class Test {
  public static void main(String[] arguments) {
    System.out.println(SubClass.CONSTANT);
    System.out.println(SuperClass.CONSTANT);
  }
}


the reference to SuperClass in main is correct
the reference to SubClass in main is incorrect (includes the .CONSTANT)
Comment 4 Jerome Lanneluc CLA 2002-05-27 09:06:59 EDT
Sorry about that. I forgot to fix the part that computes the source positions.

Fixed in build > 20020527
Comment 5 Olivier Thomann CLA 2002-06-03 14:30:21 EDT
Verified in F2.