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 229830 - Wrongly encapsulates fields
Summary: Wrongly encapsulates fields
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 7.3
Hardware: PC Windows 8 x64
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on: 230922
Blocks:
  Show dependency tree
 
Reported: 2013-05-16 08:37 UTC by rudyment
Modified: 2016-05-20 14:26 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 rudyment 2013-05-16 08:37:12 UTC
Product Version = NetBeans IDE Dev (Build jdk8lambda-1727-on-20130516)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_21
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.21-b01

I have the class:

public static class Duet
{
    int x, y;

    Duet() {}
    {
        this.x = 0;
        this.y = 0;
    }
}

I wanted to create getters and setters. 
In the dialog Generate Getters and Setters I have checked the class (and so both its fields) and the "Encapuslat Field" option.
NB modified the clas into the form:

public static class Duet
{
        private int x;
        int x;               //<- Here is the error
        private int y;

    Duet()
    {
        this.x = 0;
        this.y = 0;
    }

//Follows the correctly generated getters and setters
}
Comment 1 Svata Dedic 2016-05-20 14:26:07 UTC
Reported a long ago, and works in current dev trunk. I remember that I tweaked a lot breaking 'field groups' around 2014 or so.
Anyway, this bug would reside in code generator, refactoring only issues an abstract command to rewrite x, y with forms with private modifier.