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 86840 - Generate Code action does not generate initial values for attributes with multiplicity when using Generics is enabled
Summary: Generate Code action does not generate initial values for attributes with mul...
Status: VERIFIED INVALID
Alias: None
Product: uml
Classification: Unclassified
Component: Code Generation (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@uml
URL:
Keywords: REGRESSION
Depends on: 89932
Blocks:
  Show dependency tree
 
Reported: 2006-10-10 10:03 UTC by Alexandr Scherbatiy
Modified: 2007-10-19 21:11 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-10 10:03:50 UTC
Steps to reproduce:

- Create an empty Java project
- Add 'pack' package into the Java project
- Add 'MyClass'  class under the package
  -----------------------------------------------------------
  package pack;

  import java.util.List;
  import java.util.LinkedList;

  public class MyClass {
    List<String> stringList = new LinkedList<String>();
  }
  -----------------------------------------------------------
- Reverse Engineer the Java project into  UML project
- Go to the UML project
- Generate code for the 'MyClass' class element
- Go to the generated code
  -----------------------------------------------------------
  package pack;

  public class MyClass {
    private List<String> stringList = new ;
  }
  -----------------------------------------------------------
  The initial value is not properly generated for 'stringList'
  attribute.
Comment 1 Craig Conover 2006-10-11 20:42:11 UTC
This will be addressed when Generics are supported. See issue 78539.

*** This issue has been marked as a duplicate of 78539 ***
Comment 2 Alexandr Scherbatiy 2006-10-12 10:09:17 UTC
The issue 78539 says that if you add 'SomeClass attribute[]' attribute
into UML element it should be generated for example into 
'List<SomeClass> attribute;' (depends on your preferences)

The issue 86840 says that code 
---------------------------------------------------
public class MyClass<T> {
    MyClass<Object> m = new MyClass<Object>();
}
---------------------------------------------------
will be replaced by:
---------------------------------------------------
public class MyClass {
    private MyClass<Object> m = new ;
}
---------------------------------------------------

1) the issue 86840 has nothing in Collections
2) if issue 78539 is fixed it will not mean that issue 86840 will be
   fixed too. 
Comment 3 Peter Lam 2006-10-17 23:24:19 UTC
With latest build 061017_5, the result is even worse. Guess it's because issue
78452, so here's the generated code. Or the code detail was lost during reverse
engineering. This is a regression from JSE 8.1 UML version which gives exactly
the same piece of code after reverse engineering and generate code again.

package pack;

public class MyClass {
}
Comment 4 Craig Conover 2006-11-22 00:22:55 UTC
Changed the summary to be more accurate.
Comment 5 Craig Conover 2006-11-22 00:49:37 UTC
This is not a code generation issue. It is using exactly what is specified as
the initial value in the Default property for the Navigable Aggregation link.
The Default property value after reverse engineering the data memeber:
    private LinkedList<String> stringList = new LinkedList<String>();
is "new". The RE process did not properly parse the initial value.

Changed the Subcomponent to Reverse Engineering and set status to Invalid only
for the purpose of flagging for review. iTeam should re-evaluate whether this is
a coco-stopper, and priority level (P2 currently).
Comment 6 Alexandr Scherbatiy 2006-11-23 11:20:15 UTC
I have created the root issue 89932 in reverse engineering subcomponent
and marked this issue as depending on it.
Comment 7 Craig Conover 2006-11-27 21:31:27 UTC
This issue should be closed as "works for me" or "invalid" because as I stated,
this is working as expected. If you supply the proper value for the default
value property, it will generate proper code. So I don't see the need to leave
this issue open.

Perhaps this issue should be changed to an enhancement where the default value
validates it's value?
Comment 8 Craig Conover 2006-11-28 19:10:25 UTC
issue 89932 is the real issue here and this is not an issue because it is
garbage in, garbage out.
Comment 9 Andrew Korostelev 2006-12-01 07:26:23 UTC
verified in ide-coco-061130_13
this is also not reproducible after issue 89932 is fixed