Bug 530378 - [JFace]Javadoc for IStructuredSelection.toList erroneously suggests that the selection's contents may be modified
Summary: [JFace]Javadoc for IStructuredSelection.toList erroneously suggests that the ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 7
: P3 minor (vote)
Target Milestone: 4.8 M7   Edit
Assignee: Michael Keppler CLA
QA Contact:
URL:
Whiteboard:
Keywords: bugday, helpwanted
Depends on:
Blocks:
 
Reported: 2018-01-26 08:24 EST by Florent Latombe CLA
Modified: 2018-04-03 11:11 EDT (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 Florent Latombe CLA 2018-01-26 08:24:44 EST
IStructuredSelection.toList javadoc states: "In the default implementation of toList() in StructuredSelection the returned list is not a copy of the elements of the receiver and modifying it will modify the contents of the selection."

In StructuredSelection, the toList implementation actually returns Arrays.asList(...) which is of type java.util.Arrays.ArrayList<E> which throws UnsupportedOperationException for both 'add' and 'remove'.

The javadoc should probably be updated to reflect the fact that the contents of an IStructuredSelection cannot be modified.


--
Jface version 3.12.2.
Comment 1 Lars Vogel CLA 2018-01-26 09:20:55 EST
Gerrit reviews are welcome
Comment 2 Eclipse Genie CLA 2018-04-03 10:47:12 EDT
New Gerrit change created: https://git.eclipse.org/r/120642
Comment 4 Lars Vogel CLA 2018-04-03 11:11:50 EDT
Thanks, Michael.