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 248866

Summary: Rename or move of type can lead to change of behavior or compile error
Product: java Reporter: Jachym_Vojtek
Component: RefactoringAssignee: Ralph Ruijs <ralphbenjamin>
Status: REOPENED ---    
Severity: normal    
Priority: P3    
Version: 8.0.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description Jachym_Vojtek 2014-11-24 15:31:46 UTC
a.X() (class X with default constructor in package 'a') 
a.X1(String) 

b.Y() 

c.Z(JPanel) 
c.Y(Exception) 


import b.*; 
public class X { 
  Y y = new Y(); 
} 


1) rename a.X1->a.Y 

2) move c.Y->a.Y 

3) move a.X->c.X 

-- 

a.X() 
a.X1(String) 

b.Y() 

c.Z(JPanel) 


import b.*; 
import c.Z; 

public class X { 
  Y y = new Y(); 
} 

4) rename c.Z->c.Y 

-- 

import b.Y; 
import c.Z; 

public class X { 
  Y y = new Y(); 
} 

5) rename c.Z->c.Y 

-- 

import b.*; 
import c.*; 

public class X { 
  Y y = new Y(); 
} 

6) rename c.Z->c.Y 

-- 

a.Y(Exception) 
a.X() 
a.X1(String) 

b.Y() 

c.Z(JPanel) 

public class X { 
  Y y = new Y(); 
} 

7) rename c.Z->c.Y
Comment 1 Jachym_Vojtek 2014-11-27 07:58:32 UTC
Once more the example 7, type Y is imported from current package)

package a; 

import c.Z; 

public class X { 
    Y y = 
        new Y(); 
} 

-- 
package a; 

public class Y { 
    public Y() { 
        super(); 
    } 
} 
-- 
package c; 

public class Z { 
    public Z(Exception e) { 
    } 
} 
-- 
rename c.Z->c.Y
Comment 2 Martin Balin 2016-07-07 07:15:45 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 3 Jachym_Vojtek 2016-07-11 06:36:23 UTC
I was able to reproduce at least #1 in NetBeans IDE Dev (Build 201607110002)

Enclosed sources:
package nb248866.a;

import nb248866.b.*;

public class X {

    Y y = new Y();
}
--
package nb248866.a;

public class X1 {

    public X1(String s) {
    }
}
--
package nb248866.b;

public class Y {
    
}
--
package nb248866.c;

public class Y {
    public Y(Exception e) {
    }
}
--
package nb248866.c;

import javax.swing.JPanel;

public class Z {
    public Z(JPanel pnl) {}
}