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.
In several projects I've been working on, there have been strict guidelines about the naming of e.g. fields. One example was to name all instance fields with a m_ prefix, all static fields with s_ and all method parameters with u_. In a situation like this the "encapsulate field" refactoring is almost unusable because for a field private int m_foo; it produces the following code which doesn't comply to the coding standard: public void setM_foo(int m_foo) { this.m_foo = m_foo; } public int getM_foo() { return this.m_foo; } It takes approximately the same amount of work to fix this (even when correcting the method names in the refactoring dialog) as for writing the methods manually. Instead, the code should look like this: public void setFoo(int u_foo) { m_foo = m_foo; } public int getFoo() { return m_foo; } My suggestion is to provide advanced options for the refactoring to be able to specify these prefixes (preferrably on a per-project basis) and take them into account when generating the getter/setter methods. If instance field and method parameter name prefixes are set and different from each other, the "this." prefix can also be omitted.
*** Bug 49911 has been marked as a duplicate of this bug. ***
Fixed by 80f139ccdada
Integrated into 'main-golden', will be available in build *201305021042* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/80f139ccdada User: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org> Log: #228870 - New API to support CodeStyle's prefix/suffix #65315 #81243 #224242 - Use CodeStyle's prefix and suffix configuration