mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SortedCollectionWithNonComparableKeys.html: wording updated
This commit is contained in:
+10
-9
@@ -1,17 +1,18 @@
|
||||
<html>
|
||||
<body>
|
||||
Reports construction of sorted collections like <code>new TreeSet<>()</code> which rely on natural order,
|
||||
but their element type does not implement the <code>Comparable</code> interface.
|
||||
Such collection will unlikely to work properly.
|
||||
Reports construction of sorted collections, for example <code>new TreeSet<>()</code>, that rely on natural ordering,
|
||||
but their element type doesn't implement the <code>Comparable</code> interface.
|
||||
It's unlikely that such a collection will work properly.
|
||||
<p>
|
||||
A false-positive is possible if collection element is a super-type which is not comparable, but it's intended to
|
||||
hold only comparable sub-types. This is however error-prone. It's better to narrow the collection element type
|
||||
or declare the super-type as comparable.
|
||||
</p>
|
||||
<p>
|
||||
An option is provided to suppress the warnings on type parameters.
|
||||
A false positive is possible if the collection element is a non-comparable super-type,
|
||||
but it's intended to hold only comparable sub-types. This is however error-prone.
|
||||
It's better to narrow the collection element type or declare the super-type as <code>Comparable</code>.
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user