-
-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Truffle] No need for a special branch in Array#[].
* ArrayUtils.extractRange can handle start == end == source.length. * Update wrong documentation (see assertions).
- Loading branch information
Showing
2 changed files
with
4 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ public abstract class ArrayUtils { | |
/** | ||
* Extracts part of an array into a newly allocated Object[] array. Does not perform safety checks on parameters. | ||
* @param source the source array whose values should be extracted | ||
* @param start the start index, must be >= 0 and < source.length | ||
* @param start the start index, must be >= 0 and <= source.length | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
thomaswue
Contributor
|
||
* @param end the end index (exclusive), must be >= 0 and <= source.length and >= start | ||
* @return a newly allocated array with the extracted elements and length (end - start) | ||
*/ | ||
|
@@ -45,7 +45,7 @@ private static boolean checkExtractRangeArgs(int[] source, int start, int end) { | |
/** | ||
* Extracts part of an array into a newly allocated Object[] array. Does not perform safety checks on parameters. | ||
* @param source the source array whose values should be extracted | ||
* @param start the start index, must be >= 0 and < source.length | ||
* @param start the start index, must be >= 0 and <= source.length | ||
* @param end the end index (exclusive), must be >= 0 and <= source.length and >= start | ||
* @return a newly allocated array with the extracted elements and length (end - start) | ||
*/ | ||
|
@@ -69,7 +69,7 @@ private static boolean checkExtractRangeArgs(long[] source, int start, int end) | |
/** | ||
* Extracts part of an array into a newly allocated Object[] array. Does not perform safety checks on parameters. | ||
* @param source the source array whose values should be extracted | ||
* @param start the start index, must be >= 0 and < source.length | ||
* @param start the start index, must be >= 0 and <= source.length | ||
* @param end the end index (exclusive), must be >= 0 and <= source.length and >= start | ||
* @return a newly allocated array with the extracted elements and length (end - start) | ||
*/ | ||
|
@@ -93,7 +93,7 @@ private static boolean checkExtractRangeArgs(double[] source, int start, int end | |
/** | ||
* Extracts part of an array into a newly allocated Object[] array. Does not perform safety checks on parameters. | ||
* @param source the source array whose values should be extracted | ||
* @param start the start index, must be >= 0 and < source.length | ||
* @param start the start index, must be >= 0 and <= source.length | ||
* @param end the end index (exclusive), must be >= 0 and <= source.length and >= start | ||
* @return a newly allocated array with the extracted elements and length (end - start) | ||
*/ | ||
|
@thomaswue Can you confirm this fix is right? (see the asserts below)
Of course this potentially create empty arrays but that is the caller responsibility to do something if it should be avoided.