History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEABKL-4406
Type: New Feature New Feature
Status: Open Open
Priority: Normal Normal
Assignee: Unassigned
Reporter: Dirk Dittert
Votes: 0
Watchers: 1
Available Workflow Actions

Mark as Stalled
Operations

If you were logged in you would be able to see more operations.
IDEA: Backlog

Add new annotation: @Constant

Created: 19 Dec 05 17:46   Updated: 09 Nov 06 20:27
Component/s: Code Analysis. Inspection
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 4,069


 Description  « Hide
I'd like too see another annotation that marks a Collection as read only.

I frequently have things like:

private final List myList = new LinkedList();

/** Returns the list. Please note: this list is read-only */
public List getSomeList() {
    return myList;
}

whereas the correct way of doing it would be:

Unable to find source-code formatter for language: java. Available languages are: xhtml, javascript, java, none, html, actionscript, xml, sql
public List getSomeList() {
    return Collections.unmodifiableList(myList);
}

If all programmers follow the contract, it is no problem that the list is mutable. However, it would be nice to have some IDE support to avoid this error: An annotation to mark the list and an inspection like "Warning: Modification of collection marked as read-only"



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.