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

Summary: newDetailRecord should not generate Collection
Product: guibuilder Reporter: Patrick Keegan <pkeegan>
Component: BindingAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: blocker    
Priority: P4    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

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. :)