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 201154

Summary: [Change Method Parameter] Change Accessibility - Increase method visibility enables overriding (behavioral change)
Product: java Reporter: rohitgheyi
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 7.0.1   
Hardware: PC   
OS: Mac OS X   
Issue Type: DEFECT Exception Reporter:

Description rohitgheyi 2011-08-20 16:59:01 UTC
NetBeans IDE 7.0.1 (Build 201107282000)

Steps to reproduce: apply Change Method Parameter refactoring on the following program:

public class A {
  private int k() {
    return 1;
  }
  int m() {
    return k();
  }    
}
public class B extends A {
  int k() {
    return 2;
  }
  int test() {
    return m();
  }
}

Change Method Parameter refactoring introduces a behavioral change. In the previous program, the method test yields 1. In the following program, the method test yields 2 when an instance of B calls it.

public class A {
  int k() {
    return 1;
  }
  int m() {
    return k();
  }    
}
public class B extends A {
  int k() {
    return 2;
  }
  int test() {
    return m();
  }
}
Comment 1 Jan Becicka 2011-08-29 13:42:53 UTC
please evaluate. Thanks
Comment 2 Ralph Ruijs 2011-08-30 13:19:25 UTC

*** This bug has been marked as a duplicate of bug 21140 ***
Comment 3 Ralph Ruijs 2011-08-30 13:20:33 UTC

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