On Fri, 19 Sep 2025 02:25:50 GMT, Stuart Marks <[email protected]> wrote:
>> src/java.base/share/classes/java/util/Comparator.java line 201: >> >>> 199: * @param o1 an argument. >>> 200: * @param o2 another argument. >>> 201: * @param <U> the type of the arguments and the result. >> >> Since we are utilizing the least upper bound here, we can probably describe >> this as: >> >> "captures the least upper bound of argument types for the result type" >> >> Or should we leave an API note? > > Most docs for type arguments aren't that specific. I checked a bunch in > Collections, Collection, and Class, and they're pretty simple and not > precise. For example, in Collection we have: > > <T> T[] toArray(T[] a) > > @param <T> the component type of the array to contain the collection > > Additionally, I'm not sure that `U` is actually the LUB of the types of the > arguments. `U`'s upper bound of `T` might require it to be something > different. I think we still should describe U as only the type of result - the arguments can be more specific, U is any common supertype of the two argument types but is usually induced by Java language rule to be the lub ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25297#discussion_r2361583444
