Open anuraaga opened 4 years ago
Also realized the paragraph in the javadoc in the JRE non-android version can be tweaked to reflect the fact that all guava users are using Java 8+ now.
You're right that the class would be more ideally described as "mostly" obsolete.
Without tweaking the Javadoc, readers will search around for this method in the three mentioned classes, with the disappointing conclusion of not actually finding it at best or forever wondering if they missed something at worst.
… or be saved thanks to this post.
An issue to bring light to a long-term TODO that should probably be fixed :)
Ordering
documents itself as obsolete for Java 8+ users https://guava.dev/releases/snapshot-jre/api/docs/com/google/common/collect/Ordering.html "If you are using Java 8, this class is now obsolete. Most of its functionality is now provided by Stream and by Comparator itself, and the rest can now be found as static methods in our new Comparators class."This statement isn't actually true though since there doesn't seem to be a replacement for
Ordering.explicit
in any ofStream
,Comparator
, orComparators
. The code seems to acknowledge this with a TODOhttps://github.com/google/guava/blob/master/guava/src/com/google/common/collect/Ordering.java#L217
While the number of TODOs in a codebase usually indicate its maturity, perhaps it's a good time to address this one ;)
If a replacement could be made quickly (just copy to
Comparators
?), that'd be nice. Otherwise, simply tweaking the javadoc to explain the situation so the code doesn't need to be read would be nice. That paragraph could haveNote, there is no replacement for {@link #explicit} quite yet.
added and / or the method javadocs forexplicit
could have something likeNote, this method does not currently have a replacement in the JDK or {@link Comparators} yet.
.If any of these options sounds reasonable, I'm happy to send a PR.
Without tweaking the Javadoc, readers will search around for this method in the three mentioned classes, with the disappointing conclusion of not actually finding it at best or forever wondering if they missed something at worst.