On Sun, 6 Oct 2024 14:50:48 GMT, Markus KARG <d...@openjdk.org> wrote:
>> src/java.base/share/classes/java/io/Reader.java line 174: >> >>> 172: * @since 24 >>> 173: */ >>> 174: public static Reader of(CharSequence c) { >> >> Should we give this factory a more specific name so we don't clash in the >> future? For example, if we add another factory `of(A a)` for interface `A`, >> then it would be confusing to have an instance of `interface C extends >> CharSequence, A` to be passed to `of`. > > I do not see what is "confusing" in that case, as the caller still gets what > he intends: a reader for the passed source. I also wonder how likely that > case actually is. Anyways, I may be biased as I proposed `of`. > > @AlanBateman WDYT? You'll get different opinions on naming, personally I think Reader.of(cs) is very readable at use-sites. There are several other static methods named "of" added in other areas in recent years. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/21371#discussion_r1789694010