[OpenJDK 2D-Dev] 8187898: PrintStream should override FilterOutputStream#write(byte) with a method that has no throws clause
Alan.Bateman at oracle.com
Sat Jul 20 16:15:10 UTC 2019
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.
Tagir's suggestion to add a writeBytes(byte) seem fine, assuming there
is a great need. 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.
More information about the 2d-dev