Bug 256020 - [quick fix] Quick fix for returning an array from a collection.
Summary: [quick fix] Quick fix for returning an array from a collection.
Status: RESOLVED DUPLICATE of bug 144071
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-20 15:49 EST by Andrew Niefer CLA
Modified: 2008-11-21 03:01 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Niefer CLA 2008-11-20 15:49:08 EST
Consider the following:

    public Item[] getItems() {
        Collection items = .....
        return items;
    }


There is of course a compile error on the return statement:
 cannot convert from Collection to Item[]

It would be nice to have a quickfix to change this line to 
   return (Item[]) items.toArray(new Item[items.size()]);
Comment 1 Olivier Thomann CLA 2008-11-20 16:32:03 EST
Move to JDT/UI
Comment 2 Dani Megert CLA 2008-11-21 03:01:03 EST

*** This bug has been marked as a duplicate of bug 144071 ***