RFR 4358774: Add null InputStream and OutputStream

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Thu Dec 7 23:14:25 UTC 2017


On 07/12/2017 14:55, Brian Burkhalter wrote:
> Hi Roger,
> 
> I agree. It does not seem that whatever performance improvement might accrue from not using the Objects methods is offset by the increased code readability in addition to mitigating the risks mentioned in [1]. I have reinstated this approach in http://cr.openjdk.java.net/~bpb/4358774/webrev.02/.

Why the
     Objects.requireNonNull(b);
should be called before
     Objects.checkFromIndexSize(off, len, b.length);
since the second call will gen NPW at b.length anyway?

> 
> Thanks,
> 
> Brian
> 
> On Dec 7, 2017, at 2:04 PM, Roger Riggs <Roger.Riggs at Oracle.com> wrote:
> 
> 
>> For checking indices, I think you should leverage the work done for java.util.Objects.checkFromIndexSize(...)
>> as optimized for this purpose in 8135248.  That was extensively designed and reviewed for optimal performance.
>>
>> Regards, Roger
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8135248
> 


-- 
Best regards, Sergey.


More information about the core-libs-dev mailing list