[OpenJDK 2D-Dev] 8187898: PrintStream should override FilterOutputStream#write(byte[]) with a method that has no throws clause

Brian Burkhalter brian.burkhalter at oracle.com
Tue Jul 23 00:01:30 UTC 2019

[Dropping 2d-dev mailing list from the discussion as desktop is no longer affected.]

> On Jul 22, 2019, at 8:15 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>> On Jul 20, 2019, at 9:15 AM, Alan Bateman <Alan.Bateman at oracle.com <mailto:Alan.Bateman at oracle.com>> wrote:
>> On 18/07/2019 16:32, Brian Burkhalter wrote:
>>> Resuming this topic, what is the general view on the three possible paths:
>>> 1. Override write(byte[]) at the risk of incompatibility.
>>> 2. Instead add writeBytes(byte[]) as in ByteArrayOutputStream.
>>> 3. Resolve as Won’t Fix.
>>> For 2 or 3 the incorrect class level statement about overriding all methods not to throw IOE would need to be dealt with.
>> PrintStream dates from JDK 1.0 so I don't think it's feasible to add an override now that doesn't throw IOE.
> Agreed.
>> Tagir's suggestion to add a writeBytes(byte[]) seem fine, assuming there is a great need.
> Not sure of the need but there is the precedent of BAIS.
>> Alternatively you can add an override (that throws IOE) so that you have somewhere for an @apiNote that suggests using write(b,0,b.len) as "exception-less" write.
> That’s a good idea.

This version [1] adds writeBytes() and overrides write(byte[]) without changing its behavior. The documentation of write(byte[]) points the user to writeBytes() and write(byte[],int.int).



[1] http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.01/

More information about the core-libs-dev mailing list