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 74493

Summary: Changing method signature to an existing one
Product: editor Reporter: Tim Lebedkov <lebedkov>
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: RESOLVED INVALID    
Severity: blocker    
Priority: P3    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 65780    

Description Tim Lebedkov 2006-04-06 11:08:45 UTC
For the following class:

class A {
 public A() {}
 public A(String txt) {}
}

changing the method signature from A(String) to A() is not possible 
because A() already exist. But it should be possible!
In this case the method A(String) should just be removed.

It is probably an enhancement.

Thank You
Comment 1 Ralph Ruijs 2011-05-23 12:10:12 UTC
IMO changing a method signature to an existing one should not be possible. A refactoring should not change the outcome of a program and creating a second method with the same signature makes the code invalid.

The proposed fix of deleting the second method is will almost certainly change the outcome of the program. If the desired result is to change all method calls from one method to another the following should be done instead:

1. change the method to delegate to the desired method (in this case A()).
2. inline the old method, therefore changing all the method calls to the delegated method.