Hi Brent, I agree with you, IllegalArgumentExceptions will help to catch invalid cases if we change the source in future. Please go ahead with integration.
Thank you, Vladimir >25 Oct 2019, 8:28 +03:00 от Brent Christian <brent.christ...@oracle.com>: > >Hi, Vladimir > >I'd prefer to keep the code as is. Perhaps the exception could help >some other future maintainer to pinpoint a problem with a potential change. > >-Brent > >On 10/24/19 5:11 AM, Vladimir Yaroslavskiy wrote: >> Hi Brent, >> >> Looking at coverage of DualPivotQuicksort class, I found that >> cases of unexpected type of given array are not invoked at all >> (mentioned in my previous email). >> >> I think that these "else" can be removed, because method >> compute() of private classes are invoked from DualPivotQuicksort >> class only and we can guarantee valid array types (int[], .. , double[]). >> >> If you agree, could you please, remove such cases? >> >> Replace lines 4147-4148: >> >> throw new IllegalArgumentException( >> "Unknown type of array: " + a.getClass().getName()); >> >> by return null; >> >> remove lines 4099-4101: >> >> } else { >> throw new IllegalArgumentException( >> "Unknown type of array: " + dst.getClass().getName()); >> >> and remove lines 4030-4033: >> >> } else { >> throw new IllegalArgumentException( >> "Unknown type of array: " + a.getClass().getName()); >> >> ----- >> >> And doe the same for Sorting class: remove 12 cases >> fail("Unknown type of array: " + .... >> >> Thank you, >> Vladimir >> -- Vladimir Yaroslavskiy