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 90664 - RE does not correctly parse initial value of arrays
Summary: RE does not correctly parse initial value of arrays
Status: VERIFIED FIXED
Alias: None
Product: uml
Classification: Unclassified
Component: Reverse Engineering (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Kris Richards
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-06 14:44 UTC by Alexandr Scherbatiy
Modified: 2007-10-19 21:06 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The excessive comma is added (IDE snapshot) (110.89 KB, image/png)
2007-01-19 14:48 UTC, Alexandr Scherbatiy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandr Scherbatiy 2006-12-06 14:44:01 UTC
Steps to reproduce:

- Reverse engineer the following java class into a UML project:
  ---------------------------------------------------------------------
  public class Test {

    double[][] array = new double[][] { {1, 2}, {3, 4} };
    
  }
  ---------------------------------------------------------------------

- Create a Class diagram for 'Test' class element
  The 'Test' class element has the following attribute:
  ---------------------------------------------------------------------
  package double[0..*,0..*] array = new double[[]], { {1, 2}, {3, 4} }
  ---------------------------------------------------------------------
  The initial value is generated incorrectly

- Try generating code for the UML project and building it.

  There are some compiler errors:
  ---------------------------------------------------------------------
  JavaApplication2-ModelSources\src\pack\Test.java:9: illegal start of expression
    double[][] array = new double[[]], {{1, 2}, {3, 4}};
 JavaApplication2-ModelSources\src\pack\Test.java:9: ']' expected
    double[][] array = new double[[]], {{1, 2}, {3, 4}};
  2 errors
  ---------------------------------------------------------------------
Comment 1 Kris Richards 2007-01-16 19:35:51 UTC
ArrayDeclarationExpression.toString() needed to change the order in which the declaration was being 
created.
Comment 2 Alexandr Scherbatiy 2007-01-19 14:47:10 UTC
The fix is incomplete.
The excessive comma is added after the multidimensional array type declaration.
See the attached IDE snapshot.
Comment 3 Alexandr Scherbatiy 2007-01-19 14:48:57 UTC
Created attachment 37524 [details]
The excessive comma is added (IDE snapshot)
Comment 4 Peter Lam 2007-03-20 23:20:52 UTC
low use case not currently impacting our installed user base.
Comment 5 Alexandr Scherbatiy 2007-05-24 11:34:42 UTC
The same is for one-dimensional arrays:
 public class Test {
   private Object[] obj = new Object[] { "4", null };
 }
Comment 6 Kris Richards 2007-06-27 20:33:44 UTC
removed comma from ExpressionStateHandler.toString()
Comment 7 Sherry Zhou 2007-09-19 19:57:04 UTC
verified in trunk build 070919