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 198740

Summary: Refactor, encapsulate array of boolean field.
Product: java Reporter: sguha
Component: SourceAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P2    
Version: 7.0   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description sguha 2011-05-19 16:22:30 UTC
//---------------------
// Before refactoring. 
//---------------------
public class SomeThing {

  boolean dummy[];

}

//---------------------
// After refactoring. Netbeans 7.0
//---------------------
public class SomeThing {

private boolean dummy[];

   /**
     * @return the dummy
     */
    public boolean dummy[] getDummy()
    {
        return dummy;
    }

    /**
     * @param dummy the dummy to set
     */
    public void setDummy(boolean dummy[] dummy)
    {
        this.dummy = dummy;
    }
}

Observe that "getDummy()" returns "public boolean dummy[] "
instead of "public boolean[] ". 
The problem is, it also includes the array variable name "dummy" in the 
return segment. In the setDummy() also the same problem. 

Work around: edit it the wrong getter and setter method
manually, after refactoring. 

Use of getter methods are correctly done, did not test with the setters.
Array of doubles work fine. 
Thanks - sguha
Comment 1 sguha 2011-05-19 17:45:14 UTC
Correction: Happened for array of doubles also.
Just double worked fine.
Comment 2 sguha 2011-05-19 17:55:58 UTC
<b>Correction</b>:

Problem case: 
if the array is defined as 
double arr []; 
then only the encapsulate refactor creates bad code.

Ok Case:
If it is defined as 
double [] arr;
then the encapsulate refactor operation works fine.
Comment 3 Jan Becicka 2011-05-20 10:27:23 UTC
the problem seems to be in code generator. Refactoring seems to pass all types correctly.
Comment 4 Jan Lahoda 2011-05-22 17:47:31 UTC
Same root cause as bug #197584.

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