Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 5219

Summary: Copy CU should update references in CU
Product: [Eclipse Project] JDT Reporter: Dirk Baeumer <dirk_baeumer>
Component: UIAssignee: Adam Kiezun <akiezun>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: dlwhiteman, n.a.edgar, peter_burka
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Dirk Baeumer CLA 2001-10-24 13:26:01 EDT
Consider the following case:

class A {
  A a;
  public A() {
  }
}

Copy the CU. You get the following code

class CopyOfA {
  A a;
  public CopyOfA () {
  }
}

Note that the declaration A a; didn't get updated. It would be nice if the
copy would also update those references. It does update the top level type
name and the constructors.
Comment 1 Adam Kiezun CLA 2001-10-31 12:00:53 EST
this would introduce 4th level of smartness into our reorg actions:
. full - most rename actions (renames symbol and updated all refs to it)
. some - in case of renaming a cu with syntax errors we update type 
declarations and constructors
. none - just do it- nothing more

would that be really useful?
would that not introduce uncecessary user confusion?
Comment 2 Dirk Baeumer CLA 2001-10-31 12:55:14 EST
IMO it doesn't introduce user confusion since the current solution does only 
half of the job. It renames the type and the constructor but no references
inside the type to itself. As a consequence I can't rename the CopyOfA CU
into C and get a compilable CU. I still have the bogus reference to A.
Comment 3 Adam Kiezun CLA 2001-11-02 07:05:59 EST
i'd like to avoid putting renaming code into the copy operation 
(i'd make thing messy i think. plus, should i do name conflict detection then 
as well?).
i guess, i general, 'copy' is not intended to be very smart.

the type declaration and constructor renaming is doen by jcore.
maybe removing that and simply renming the file would be acceptable?
Comment 4 Adam Kiezun CLA 2002-01-11 11:13:25 EST
*** Bug 7490 has been marked as a duplicate of this bug. ***
Comment 5 Adam Kiezun CLA 2002-03-21 04:53:35 EST
implementing Dirk's original suggestion to update refs inside the cu is the way 
to go, i think
Comment 6 Adam Kiezun CLA 2002-03-27 09:21:30 EST
*** Bug 7512 has been marked as a duplicate of this bug. ***
Comment 7 Adam Kiezun CLA 2002-04-26 04:41:23 EDT
*** Bug 14655 has been marked as a duplicate of this bug. ***
Comment 8 Adam Kiezun CLA 2002-04-26 13:31:43 EDT
fixed - references in the copied cu are updated now