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 236104 - Java Ordering: public field moved below static methods against ordering
Summary: Java Ordering: public field moved below static methods against ordering
Status: RESOLVED INVALID
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-18 12:26 UTC by MackSix
Modified: 2013-09-19 06:21 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of Java ordering settings in Options. (90.77 KB, image/png)
2013-09-18 12:26 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-09-18 12:26:22 UTC
Created attachment 140211 [details]
Screenshot of Java ordering settings in Options.

1. Example code:

public class Word {
    private static int count;
    private String word;    

    public static int getCount() {
        return count;
    }

    public static void setCount(int aCount) {
        count = aCount;
    }

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }
}

2. Ordering is set in Options >> Formatting  to:

static fields
fields
static initializers
static methods
instance initializers
constructors
methods
static classes
classes

(See attached screenshot)

3. Invoke Source >> Organize Members


Result is non-static field is moved below static methods when it should be left where it. Code:

public class Word {
    private static int count;

    public static int getCount() {
        return count;
    }

    public static void setCount(int aCount) {
        count = aCount;
    }
    private String word;    

    public String getWord() {
        return word;
    }

    public void setWord(String word) {
        this.word = word;
    }
}

When using Refactor >> Encapsulate Fields to add the getters & setters, the ordering is messed up like this too.
Comment 1 MackSix 2013-09-18 12:32:45 UTC
Product Version: NetBeans IDE 7.4 RC1 (Build 201309112301)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b48
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b106
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb
Comment 2 MackSix 2013-09-19 06:21:18 UTC
Project specific settings were set, sorry.