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 215679

Summary: Refactoring "Change method Parameter" does not consider existing local variables in overriding methods
Product: java Reporter: Jachym_Vojtek
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: REOPENED ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description Jachym_Vojtek 2012-07-18 11:51:52 UTC
Example:

public class Class0 {    

    public void test(int i) {           
    }
}

class Class1 extends Class0 {

    @Override
    public void test(int i) {
        int x;        
    }
}

When you try to add parameter named "x" using refactoring on method Class1.test(int i) refactoring warns you 'Name "x" is already used as name of local variable'.
But when you try to do the same (adding x parameter) on Class0.test(int i) refactoring is performed and as a result you get:

class Class1 extends Class0 {

    @Override
    public void test(int i, Object x) {
        int x;        
    }
}
with duplicated variable "x"
Comment 1 Martin Balin 2015-09-17 11:16:12 UTC
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.
Comment 2 Jachym_Vojtek 2015-09-17 11:46:34 UTC
This is simply reproducible in NetBeans IDE Dev (Build 201509150002).
Well, I guess that closing bugs which remain untouched (regrettably) for 3 years is a common practice of the development process.
But from my point of view, I can think that it is waste of my time (in fact the waste of time of our company) to report bugs on NB.