Bug 46765 - [rename] Type rename doesn't handle case where homonym is accessible
Summary: [rename] Type rename doesn't handle case where homonym is accessible
Status: RESOLVED DUPLICATE of bug 33222
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-17 07:11 EST by Philipe Mulet CLA
Modified: 2006-06-14 13:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2003-11-17 07:11:48 EST
Build 20031023

With JDT Core source project, select type 
org.eclipse.jdt.internal.compiler.ast.AstNode
and rename it into: ASTNode

Refactoring will notice there is a DOM type
with the same name; but when proceeding it will
fail to update properly DOM code which was referring
to AstNode and ASTNode (old references to AstNode should
have been converted to org.eclipse.jdt.internal.compiler.ast.ASTNode
to avoid confusion).
Comment 1 Dirk Baeumer CLA 2003-11-17 13:34:56 EST
Rename type is fully search engine based. So if we miss some references then 
they are not present in the search result or they are reported as inexact 
matches. We ignore inexact matches since we can't be sure that we are doing 
the right thing. 

Philippe, do you remember which CU didn't get updated.
Comment 2 Philipe Mulet CLA 2003-11-18 05:32:56 EST
Sources living in package org.eclipse.jdt.core.dom which were referring to 
AstNode through an import (and also to the homonym ASTNode which lives in the 
same package). I suspect the check for conflicts did not notice there was 
another sibling type within the same package, and thus did not need any import.

An example is org.eclipse.jdt.core.dom.AstConverter, which is correctly found 
as a reference to type AstNode.
Comment 3 Dirk Baeumer CLA 2003-11-18 09:41:15 EST
The rename refactoring issues a warning that 3 compilation units reference a 
different type ASTNode. This is a clear indication that the refactoring will 
not produce a correct result.

Doing the right thing in this case is to convert all unqualified references to 
AstNode to fully qualified references to AstNode to make sure they don't 
conflict with each other. But this requires a rewrite of rename, since the 
current rename isn't AST based (it is based on position reported from the 
search engine).

Problematic is that we only issue a warning here. It should be an error.
Comment 4 Dirk Baeumer CLA 2003-11-18 09:55:48 EST
Upgraded the warning to an error. 

Updating the references to fully qualified references has to wait until we 
recode the refactoring to be AST based. Doing so will allow to remove the 
issued warnings/errors.
Comment 5 Philipe Mulet CLA 2003-11-18 10:54:42 EST
Sounds fair for now
Comment 6 Markus Keller CLA 2006-06-14 13:29:54 EDT

*** This bug has been marked as a duplicate of 33222 ***