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.
Scenario: - Create Quote project - Open customer.h file - Call "Refactor|Encapsulate Fields" context menu in Customer class - Press "Select Setters" button - Select "Last Method" in "Insert Point" combobox - Press "Refactor" button - Open customer.cc file ==> #include "customer.h" Customer::Customer(const string initName, int initDiscount) : name(initName), discount(initDiscount) { } int Customer::GetDiscount() const { return discount; } void Customer::SetDiscount(int discount) { this->discount = discount; } void Customer::SetName(string name) { this->name = name; } string Customer::GetName() const { return name; } ostream& operator <<(ostream& output, const Customer& customer) { output << customer.name << " has discount " << customer.discount << '%'; return output; }
I'm lost what is expected here :-) setter were inserted in header after GetDiscount() => in cpp they were tried to be inserted after the same function.
Ok. Other sample. Source files in project ====== main.cpp ============ #include "class1.hpp" int main() { Class1 c1; c1.method1(1); return 0; } ====== class1.cpp ============ #include "class1.hpp" Class1::Class1() { } void Class1::method1(int a) { i = a; return; } void Class1::method2(int a) { j = a; return; } void Class1::method3() { return; } ====== class1.hpp ============ class Class1 { public: Class1(); void method1(int a); void method2(int a); private: void method3(); int i; int j; }; ============================= Scenario: - Call "Refactor|Encapsulate Fields" context menu in Class1 class - Press "Select All" button - Select "After method3(): void" in "Insert Point" combobox - Press "Refactor" button ==> expected result: ====== class1.cpp ============ void Class1::method3() { return; } <-- new getters and setters should be added ====== class1.hpp ============ private: void method3(); <-- new getters and setters should be added int i; int j; =============================
fixed: http://hg.netbeans.org/cnd-main/rev/87faa112f42a