Files
openide/java/java-impl/resources/inspectionDescriptions/SortedCollectionWithNonComparableKeys.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

20 lines
962 B
HTML

<html>
<body>
Reports construction of sorted collections, for example <code>TreeSet</code>, that rely on natural ordering,
whose element type doesn't implement the <code>Comparable</code> interface.
<p>It's unlikely that such a collection will work properly.</p>
<p>
A false positive is possible if the collection element type is a non-comparable super-type,
but the collection is intended to only hold comparable sub-types. Even if this is the case,
it's better to narrow the collection element type or declare the super-type as <code>Comparable</code> because the mentioned approach is error-prone.
</p>
<!-- tooltip end -->
<p>
The inspection also reports cases when the collection element is a type parameter which is not declared as <code>extends Comparable</code>.
You can suppress the warnings on type parameters using the provided option (for example, to keep the API compatibility).
</p>
<p>
<small>New in 2018.3</small>
</p>
</body>
</html>