[OpenJDK 2D-Dev] 8187898: PrintStream should override FilterOutputStream#write(byte[]) with a method that has no throws clause
Lance Andersen
lance.andersen at oracle.com
Tue Jul 23 17:03:22 UTC 2019
Hi Brian
A couple of minor suggestions:
For
———
@Override
public void write(byte buf[]) throws IOException {
super.write(buf, 0, buf.length);
}
———
You will want to add an @throws
The implSpec
—————
* @implSpec
* The default implementation is equivalent to
* {@link java.io.FilterOutputStream#write(byte[],int,int)
* super.write(buf,0,buf.length)}.
*
——————
Not sure if “The default implementation” is the correct wording given it is not a default method (not sure what the norm is for describing the implementation in this case). Perhaps something like “This method is equivalent to calling ….”
Where you have
————
* <p> Note that the bytes will be written as given; to write characters
* that will be translated according to the platform's default character
* encoding, use the {@code print(char[])} or {@code println(char[])}
* methods.
*
——————
Did you consider this as a candidate for @apiNote as well?
HTH
Lance
> On Jul 23, 2019, at 12:41 PM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>
>
>
>> On Jul 23, 2019, at 8:27 AM, Brian Burkhalter <brian.burkhalter at oracle.com> wrote:
>>
>>> On Jul 23, 2019, at 8:20 AM, Alan Bateman <Alan.Bateman at oracle.com <mailto:Alan.Bateman at oracle.com>> wrote:
>>>
>>> On 23/07/2019 16:08, Brian Burkhalter wrote:
>>>>
>>>> I don’t see what you mean.
>>>> @Override
>>>> public void write(byte buf[]) throws IOException {
>>>> super.write(buf);
>>>> }
>>>> Should “trouble” be set and the IOE re-thrown?
>>>>
>>> super.write(byte[]) will invoke PrintStream overrides write(byte[], int, int) so IOE won't be thrown (and why the proposed change to the class description isn't right). The method description is probably the best place to describe the behavior.
>
> Here is an update which accounts for the foregoing comments.
>
> http://cr.openjdk.java.net/~bpb/8187898/webrev-alt.02/
>
> Thanks,
>
> Brian
>
<http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
More information about the core-libs-dev
mailing list