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 151979 - newDetailRecord should not generate Collection
Summary: newDetailRecord should not generate Collection
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Binding (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-31 14:17 UTC by Patrick Keegan
Modified: 2009-05-25 20:57 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 Patrick Keegan 2008-10-31 14:17:53 UTC
When creating a master/detail form in the JDA wizard, the main view's newDetailRecord() method always has a local
variable of type Collection generated, even if it is assigned the value of a List, and then has to be cast to List later
in the method, 

e.g. 
        Collection<desktopapplication2.Orders> os = c.getOrdersCollection();
        if (os == null) {
            os = new LinkedList<desktopapplication2.Orders>();
            c.setOrdersCollection((List)os);
        }
(where getOrdersCollection() returns a List) could be changed to:

        List<desktopapplication2.Orders> os = c.getOrdersCollection();
        if (os == null) {
            os = new LinkedList<desktopapplication2.Orders>();
            c.setOrdersCollection(os);
        }

issue 151977 filed to rename the OrdersCollection field to OrdersList in these cases
Comment 1 Jiri Vagner 2008-12-11 09:47:41 UTC
>> where getOrdersCollection() returns a List, could be changed to ...
?? If getOrdersCollection() method returns a list, control jumps to the end of that "if" statement and skips that two lines.


From my point of view "problem" is only inside that IF ...

  os = new LinkedList<desktopapplication2.Orders>();  // "os" WILL contain List
  c.setOrdersCollection((List)os); // no need to cast "os" to List

Did I understand your report correctly?
Comment 2 Jiri Vagner 2008-12-11 10:24:40 UTC
Oups, Jan Stola helped me to understand your report. It's about return "type" of getOrdersCollection() and redundant
cast, so please skip my last comment. :)