Bug 16751

Summary: Renaming a class doesn't update all references
Product: [Eclipse Project] JDT Reporter: Ilja Preuss <preuss>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: akiezun
Version: 2.0   
Target Milestone: 2.0 F2   
Hardware: All   
OS: All   
Whiteboard:

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.