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 114459

Summary: reformatting a Java class with an internal enumeration loses information
Product: editor Reporter: sourcerror <sourcerror>
Component: Formatting & IndentationAssignee: issues@editor <issues>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P1    
Version: 6.x   
Hardware: PC   
OS: Windows Vista   
Issue Type: DEFECT Exception Reporter:
Attachments: example from issue description

Description sourcerror 2007-09-02 22:31:08 UTC
In 6.0M10, I found that reformatting a Java class with an internal enumeration loses information!

Here is an example where the parameters to the enumeration values are lost.  See below "A1(1), A2(2), A3(3)"

Before...

public class ReforatEnumBug {
    public enum A {
        A1(1),
        A2(2),
        A3(3);
        
        private int length;
        
        A(int length) {
            this.length= length;
        }
        
        public int getLength() { return length; }
    }

    private A a;
    
    public ReforatEnumBug() {
        a= A.A1;
    }

}


After...

public class ReforatEnumBug {

    public enum A {

        A1, A2, A3;

        private int length;

        A(int length) {
            this.length = length;
        }

        public int getLength() {
            return length;
        }
    }

    private A a;

    public ReforatEnumBug() {
        a = A.A1;
    }
}
Comment 1 sourcerror 2007-09-02 22:35:10 UTC
Created attachment 47942 [details]
example from issue description
Comment 2 sourcerror 2007-09-02 23:43:25 UTC
I tried to do a search before submitting but I guess I messed up.

Anyway, now I'm 99.9% sure this is a duplicate of #108373. :)  But I'll let someone (e.g. pflaska) confirm that is 
true.
Comment 3 Jiri Prox 2007-09-03 07:43:33 UTC
You're right it's duplicate of issue 108373. It should work fine in the latest daily build. Thanks for your report.

*** This issue has been marked as a duplicate of 108373 ***