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 106732 - enumeration source is not updated when code is regenerated with changes
Summary: enumeration source is not updated when code is regenerated with changes
Status: VERIFIED FIXED
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Viktor Lapitski
URL:
Keywords: REGRESSION
: 106475 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-15 00:43 UTC by Peter Lam
Modified: 2007-06-30 01:28 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 Peter Lam 2007-06-15 00:43:15 UTC
using build netbeans-hudson-trunk-733-full.zip (070614)

After the code is generated for enumation with marker, updating enumeration from diagram then code regeneration does not
update source.

Repro steps:
- create and name an enumeration element on the class diagram
- add 2 literals 'A' & 'B'
- generate code for the element
- navigate to the source and the source is generated as below
public enum MyEnum {

    A, B;

}

- go back to the diagram and add a 3rd literal 'C' to the element
- generate code for the element again with marker and backup
- navigate to the source and found that the following is there with expanded UML Marker

/ <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
// #[regen=yes,id=DCE.00F8AA50-B8C3-7736-65EB-FF4B79BBBD77]
// </editor-fold> 
public enum MyEnum {

    A, B;

}

The message in the output window below indicates the code gen is successful though.

Begin processing Generate Code: 1 items

Code Generation selected options:
  Source Folder Location -  E:\HydraProjs\20070614-b733\JavaApplication1\src
  Backup Sources - true
  Generate Markers - true

Processing element 1 of 1: Enumeration MyEnum ... 
  Generating source from template "CompilationUnit.java" ... Ok
  Existing Source File -  E:\HydraProjs\20070614-b733\JavaApplication1\src\MyEnum.java
  Merging with the existing source file ... Ok

================================
Task Successful (total time: 0 seconds)
Comment 1 Peter Lam 2007-06-15 00:52:03 UTC
When I unchecked the backup checkbox for code gen, it still saved a backup (see below message) and new code was
generated correctly.
Begin processing Generate Code: 1 items

Code Generation selected options:
  Source Folder Location -  E:\HydraProjs\20070614-b733\JavaApplication1\src
  Backup Sources - false
  Generate Markers - true

Processing element 1 of 1: Enumeration MyEnum ... 
  Generating source from template "CompilationUnit.java" ... Ok
  Existing Source File -  E:\HydraProjs\20070614-b733\JavaApplication1\src\MyEnum.java
  WARNING: The existing source file couldn't be parsed. It was overwritten by new version, and backup copy was created.

================================
Task Successful (total time: 0 seconds)
Comment 2 Peter Lam 2007-06-15 01:19:52 UTC
Since source merge is a main feature here so upgrading to P1.
Comment 3 Viktor Lapitski 2007-06-21 11:22:50 UTC
fixed.
Comment 4 Viktor Lapitski 2007-06-21 11:24:16 UTC
*** Issue 106475 has been marked as a duplicate of this issue. ***
Comment 5 Peter Lam 2007-06-22 23:32:49 UTC
When I added the literal 'C' as the 3rd literal from the literal list and regenerated the code, I got the following
source where literal 'C' appears before 'A' & 'B'.

// <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
// #[regen=yes,id=DCE.0D65B38E-EB04-775B-6AE9-8740EA3AB6EE]
// </editor-fold> 
public enum Enum1 {

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.386003B3-9D3D-875E-26D7-C7294D4D4188]
    // </editor-fold> 
    C,

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.05596AC5-E4B6-788E-1BAC-632744B6DEEA]
    // </editor-fold> 
    A,

    // <editor-fold defaultstate="collapsed" desc=" UML Marker "> 
    // #[regen=yes,id=DCE.BC7A427E-7F1E-A969-39FA-514253A05513]
    // </editor-fold> 
    B,;


}
Comment 6 Viktor Lapitski 2007-06-26 04:10:48 UTC
fixed in trunk and m10 branch.
Comment 7 Peter Lam 2007-06-30 01:28:18 UTC
verified in  NetBeans IDE 6.0 M10 (build 200706281431)