On Wed, 9 Dec 2020 00:32:37 GMT, Paul Sandoz <psan...@openjdk.org> wrote:
>> Stuart Marks has updated the pull request incrementally with one additional >> commit since the last revision: >> >> fix typo, clarify asserts disabled, test prefGrowth==0 > > src/java.base/share/classes/jdk/internal/util/ArraysSupport.java line 616: > >> 614: * greater than the soft maximum but does not exceed >> Integer.MAX_VALUE, the minimum >> 615: * required length is returned. Otherwise, the minimum required >> length exceeds >> 616: * Integer.MAX_VALUE, which can never be fulfilled, so this method >> throws OutOfMemoryError. > > I think you can simplify with: > > Suggestion: > > * If the preferred length exceeds the soft maximum, we use the minimum > growth > * amount. The minimum required length is determined by adding the > minimum growth > * amount to the current length. > * If the minimum required length exceeds Integer.MAX_VALUE, then this > method > * throws OutOfMemoryError. Otherwise, this method returns the soft > maximum or > * minimum required length, which ever is greater. > > Then i think it follows that `Math.max` can be used in the implementation. I agree with Paul's comment of Dec 8. Especially the s/Since/If/ I would amend with s/which ever/whichever/ but that might be my dialect of North American ------------- PR: https://git.openjdk.java.net/jdk/pull/1617