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 109284 - Enumeration: extra semicolon or comma at last of constant
Summary: Enumeration: extra semicolon or comma at last of constant
Status: VERIFIED WORKSFORME
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Viktor Lapitski
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-10 19:18 UTC by Sherry Zhou
Modified: 2008-03-27 02:05 UTC (History)
0 users

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 Sherry Zhou 2007-07-10 19:18:31 UTC
nightly build 20070710000

Extra  semicolon or comma  is generated at last of constant of enum type.

Steps to reproduce:
1. Create UML java-platform project.
2. Add an enumerate element to canvas. Add literals Winter, Spring, Summer.
3. Call Code generation and code is generated as below.
-- Note that a semicolon appears at end of last constant before the close bracket, which should be
after the close bracket.

public enum Season {

    //<maker>
    Winter,

    //<maker>
    Spring,

    // <maker>
    Summer;
}

4. Add one more literal 'Fall' 
5. Repeat step 3 to generate code.
-- a comma shows up at last constant 'Fall' as shown below:
public enum Season {

    //<maker>
    Winter,

    //<maker>
    Spring,

    // <maker>
    Summer;

    // <amker>
    Fall,;
}
Comment 1 Peter Lam 2007-07-10 19:56:59 UTC
I call it a p2 here since incorrect code generated.
Comment 2 Viktor Lapitski 2007-07-11 00:14:05 UTC
the following, correct Java, code was generated (markers removed). Last, extra, 
 comma is pretty legal according to Java lang spec&grammar 
(http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9) 

public enum Season {

    Winter,

    Spring,

    Summer,

    Fall,;


}
Comment 3 Peter Lam 2007-07-11 00:20:54 UTC
Yes, the extra comma is ok. I issue I see here is the extra semicolon (after Summer) from the description.
Comment 4 Viktor Lapitski 2007-07-11 00:24:47 UTC
trying to reproduce the issue as described i didn't get ";" after Summer.
Comment 5 Peter Lam 2007-07-11 00:30:39 UTC
I just tried with today's cb build  netbeans-hudson-trunk-1580-full.zip and not able to reproduce either. Maybe error in
copy and paste? If so, this issue is invalid.
Comment 6 Peter Lam 2008-03-27 02:05:02 UTC
just reverified again but not repro.