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 232081 - Refactor should not allow to set null value parameter
Summary: Refactor should not allow to set null value parameter
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-01 13:35 UTC by ssazonov
Modified: 2016-07-07 07:16 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ssazonov 2013-07-01 13:35:32 UTC
1. Create new class ClassA:

//----------------------------
public class ClassA{

    public ClassA() {
    }
    
    public void m1(){
        ClassA cA = new ClassA();
    }
    
}
//----------------------------

2. Put caret over constructor "ClassA"

3. invoke Refactor->Change Method Parameters... action from the popup menu.

4. In the Change Method Parameters dialog press the Add button and fill Type and Name for the new created parameter as int and id. Leave Default Value field empty.

5. Press Refactor button and you'll get this code:


//----------------------------
public class ClassA{

    public ClassA(int id) {
    }
    
    public void m1(){
        ClassA cA = new ClassA(null);
    }
    
}
//----------------------------

-> it causess the error at line "... = new ClassA(null)": incompatible types: <null> cannot be converted to int
Comment 1 ssazonov 2013-07-01 14:56:23 UTC
Product Version: NetBeans IDE Dev (Build 201306272300)
Java: 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b16
System: Windows 7 version 6.1 running on x86; Cp1252; en_US (nb)
Comment 2 Martin Balin 2016-07-07 07:16:02 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