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 87400 - Code is generated for deleted attributes/operation
Summary: Code is generated for deleted attributes/operation
Status: VERIFIED FIXED
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Craig Conover
URL:
Keywords: REGRESSION
Depends on: 87423
Blocks:
  Show dependency tree
 
Reported: 2006-10-18 13:28 UTC by Alexandr Scherbatiy
Modified: 2007-10-19 21:06 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 Alexandr Scherbatiy 2006-10-18 13:28:13 UTC
Steps to reproduce:

- Create a Java-Platform Model UML project
- Add a package with scoped Class diagram
- Put a Class element on the diagram and name It
- Generate code for the UML project
- Insert an operation to the element
- Generate code for the UML project
  Java file which contains the operation is generated for the element
- Delete the operation from the element
- Generate code for the UML project
  The operation is not removed from the java code
Comment 1 Alexandr Scherbatiy 2006-10-18 13:34:40 UTC
There is one more problem with operation/attribution modifying:

- Add 'public void op()' operation to the class element
- Generate code
  Java code is:
----------------------------
public class MyClass {
    public MyClass() {
    }

    public void op() {
    }
}
---------------------------
- Insert 'int a' argument in to the operation
- Generate code
  Java code is:
---------------------------
public class MyClass {
    public MyClass() {
    }

    public void op() {
    }

    public void op(int arg) {
    }
}
---------------------------
The java code contains 'public void op()' operation.
Is it another issue or the problem is the same as for operation deleting issue?
Comment 2 Craig Conover 2006-10-18 17:44:20 UTC
This is as designed. We may address this in FCS, however, but it is not a
regression. Here's why...

When you generate code for an element, it is just adding what is not already
there. So if you gen code for an element, then delete an attribute or an
operation from the element, and then gen code again, it is not "re-generating"
the deleted attr/ops, it just isn't removing them from the current source file.

I realize this is not intuitive, but it is known and expected at this stage of
the roundtrip redesign. Same goes for a deleted Class element. If you gen code
for an entire project, then delete a class element, and gen code again for the
project, the class is not removed from the source folder, rather it is left as is.

Basically, the RE and GC actions do not support subtractive actions at this
point. This will be addressed probably for FCS, and definitely for the next release.
Comment 3 Craig Conover 2006-10-18 22:56:06 UTC
This is now addressed. We are deleting the contents of the current source file
and regenerating all existing members of the element (literals, attr, ops, etc).
This is addressed in issue 87423
Comment 4 Andrew Korostelev 2006-10-19 07:55:01 UTC
verified in all-nbms-griffin-061018_35