-
Type:
Improvement
-
Status: Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 3.5.0
-
Fix Version/s: 3.6.0
-
Component/s: None
-
Labels:None
There are plenty of places where empty collections are returned from public API in methods written like:
public List<Exception> getExceptions() { return exceptions == null ? Collections.<Exception>emptyList() : exceptions; }
The issue with this is that the empty list is immutable but the collection returned for the nun-null case is not immutable.
All those methods should return a collection with consistent "mutability": either mutable, either immutable.
Given empty immutable collections do not cause harm until now, switching consistently to immutable collections is more conservative and should not be risky