Request for Enhancement: java.io.Writer.of(Appendable) as an efficient alternative to java.io.StringWriter
Chen Liang
liangchenblue at gmail.com
Mon Feb 10 00:51:07 UTC 2025
Hi Mark,
After thinking about the Appendable-Closeable-Flushable trio versus Writer,
I believe that one problem with Writer.of is that it goes against interface
segregation principle represented by the trifecta, and accidentally leaking
the Closeable or Flushable functionality is still dubious to me. This
appears simple, but it may cause unintended consequences, such as if
Appendable b implements Closeable too, its closing behavior is not proxied
and users may find this inconsistency weird. And as for interface
segregation principle, it means APIs should request Appendable instead of
Writer if they only need writing abilities with no lifecycle; using Writer
as the type implies potential dependency on closing/flushing behavior,
which can sometimes be dangerous.
> So how to proceed? Stop all my work for many more months?
Unfortunately, Mark, many ideas turn out not to be good ideas. I don't know
how many months have Alan's works on security manager, finalizers, or
serializations have stopped, but sometimes things have troubles, and due to
various considerations such as "not sending a false signal" or
compatibility, we often cannot take action (see https://openjdk.org/jeps/154
)
Regards,
Chen
On Sun, Feb 9, 2025 at 3:35 PM Markus KARG <markus at headcrashing.eu> wrote:
> Alan,
>
> those big projects are really much appreciated by the community.
> Nevertheless there must not be a mutual exclusive situation, as other
> contributors are working on other things which are also appreciated by
> the same community.
>
> So how to proceed? Stop all my work for many more months? Looking at the
> number and status of all those large projects I doubt that this
> situation will change drastically before end of 2025.
>
> We need to find a way that allows external contributors like me to
> proceed, though.
>
> If we haven't enough reviewers / commiters for both, we simply need to
> nominate more.
>
> -Markus
>
>
> Am 09.02.2025 um 20:27 schrieb Alan Bateman:
> > On 26/01/2025 16:37, Markus KARG wrote:
> >>
> >> As there have not been any more comments so far in the past weeks, I
> >> assume there is common agreement with my current proposal.
> >>
> > I don't think you can assume this. There are many large projects and
> > other significant efforts in progress so it's more likely that the
> > maintainers just haven't had any cycles to work through the implications.
> >
> > -Alan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250209/d375e436/attachment-0001.htm>
More information about the core-libs-dev
mailing list