This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 99421 - [rename method] Rename method should return a warning related to shadow access
Summary: [rename method] Rename method should return a warning related to shadow access
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Jan Becicka
URL:
Keywords:
: 249187 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-03-29 17:34 UTC by kely_garcia
Modified: 2015-01-09 09:58 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kely_garcia 2007-03-29 17:34:46 UTC
Build ID: 200609161800 (Netbeans 6.0 M3)

Renaming method m to k should return a warning explaining that another name 
will shadow access to the renamed element. 
Steps To Reproduce: Rename method m to k in the following:

public class A {
	private void m(){}
	class B{
		void k(){
			m();
		}
	}
}

Yields the following refactored class:
public class A {
	private void k(){}
	class B{
		void k(){
			k();
		}
	}
}

Note: In these other cases, the refactoring should also return a warning
- Rename method m to k
class B{
 	void k(){}	
}
class A extends B{
 	static public void m(){}
}

- Rename method m to k
package p;
import static p.A.m;

public class A {
     public static void m() { }     
}

class B {
    void use() {
        m();
    }
    void k() {}
}
Comment 1 kely_garcia 2007-03-30 22:11:45 UTC
Note: A similar problem happens when we have interfaces, for example:
- renaming method A.m to k yields compilation error in the following case: 
class B {
	void k(){
	}
}
class A extends B implements I{
	public void m(){
	}
}
interface I{
	void m();
}

- renaming I.m to k yields compilation error in the following case:
interface I{
    void m();
}
class A{
    public void m(){}
}
class B1 extends A implements I{
}
class B2 extends A {
    public void m(){}
    public void k(){}
}
Comment 2 kely_garcia 2007-03-31 01:44:36 UTC
I just noticed that 3 of the examples in my notes (first, third and fourth) 
correspond to a different bug and I have created Issue 99596 for them. 
Comment 3 Jan Becicka 2007-06-29 10:08:14 UTC
Yes. This is valid issue.
Comment 4 Ralph Ruijs 2015-01-09 09:58:58 UTC
*** Bug 249187 has been marked as a duplicate of this bug. ***