RFR JDK-8066678: java.nio.channels.Channels cleanup
Pavel Rappo
pavel.rappo at oracle.com
Thu Dec 4 14:46:35 UTC 2014
Chirs, Alan, done in place.
The thing I'm still thinking about is this:
if (in instanceof FileInputStream &&
FileInputStream.class.equals(in.getClass())) {
return ((FileInputStream)in).getChannel();
}
Were there any particular reasons for 'in' to be *exactly* an instance
of FileInputStream? As you've seen I changed it safely to:
if (in.getClass() == FileInputStream.class) {
return ((FileInputStream) in).getChannel();
}
But can we simply go a little bit further and change it to just:
if (in instanceof FileInputStream) {
return ((FileInputStream) in).getChannel();
}
?
Does anybody recall why it was that way in the first place?
-Pavel
> On 4 Dec 2014, at 14:01, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 04/12/2014 12:23, Pavel Rappo wrote:
>> Hi everyone,
>>
>> Could you please review my change for JDK-8066678?
>>
>> http://cr.openjdk.java.net/~prappo/8066678/webrev.00/
>>
>> It's a minor cleanup. Main things fixed:
>>
>> * Substituted Channels.checkNotNull for Objects.Objects.requireNonNull
>> (non-essential difference is the NPE message)
>> * Javadoc fixes
>>
> The change to use Objects.requireNonNull looks okay. Also removing the "open" flag from WritableByteChannelImpl is okay.
>
> I don't agree with the javadoc changes, it makes this class inconsistent with the other classes in this area. The changes to use {@code ... } are good.
>
> -Alan
More information about the nio-dev
mailing list