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 140226 - [65cat] Encapsulate field puts getter/setter over the enums
Summary: [65cat] Encapsulate field puts getter/setter over the enums
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-16 09:25 UTC by havan
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 havan 2008-07-16 09:25:49 UTC
[ BUILD # : 200807101204 ]
[ JDK VERSION : 1.6.0_07 ]

Encapsulating fields puts getter/setter methods over the enums.

To reproduce;

* Create a new java class
* Create two fields
* Encapsulate one of the fields, it generates methods under the
fields as expected.
* Create an enum over the other fields
* Now encapsulate other field. Now it generates and puts methods over
the enum.

Resulting class looks like this;

public class NewClass1 {

    /**
     * @return the s1
     */
    public String getS1() {
        return s1;
    }

    /**
     * @param s1 the s1 to set
     */
    public void setS1(String s1) {
        this.s1 = s1;
    }

    private enum Hede{ e1, e2 };

    private String s1;
    private String s2;

    /**
     * @return the s2
     */
    public String getS2() {
        return s2;
    }

    /**
     * @param s2 the s2 to set
     */
    public void setS2(String s2) {
        this.s2 = s2;
    }

}
Comment 1 Jan Pokorsky 2008-07-16 15:45:27 UTC
I can reproduce it with setting the insert point as first or last method.
Comment 2 Jan Pokorsky 2008-07-17 09:59:43 UTC
fixed as http://hg.netbeans.org/main/rev/ccb0154a9b4c
Comment 3 havan 2008-07-23 10:09:45 UTC
I can reproduce this with latest daily build; 200807221016. Am I missing something? I'm reopening the issue, please
close if I'm wrong.
Comment 4 Jan Pokorsky 2008-07-23 18:22:18 UTC
Sorry, I overlooked the step 4 (create an enum over the other fields after encapsulating one of these fields). Now I can
reproduce the described behavior too.

Unfortunately it is out of control of the refactoring module. In case you choose the 'Default' insert point the
refactoring delegate responsibility where to place new methods to the java generator (module java/source,
GeneratorUtilities.get(workingCopy).insertClassMembers(node, newMethods)).

In order to work around it choose the insert point other than the default. My fix should handle this properly.

Reassigning to java/source to evaluate GeneratorUtilities.insertClassMembers handling.
Comment 5 Jan Becicka 2008-11-13 12:49:00 UTC
P4 imo
Comment 6 Rastislav Komara 2009-02-03 10:53:54 UTC
Overtake.
Comment 7 Jan Lahoda 2009-08-20 09:58:51 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 8 Martin Balin 2016-07-07 07:16:28 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