Re: RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment, ValueLayout, long, long) spec mismatch in exception scenario [v7]

2023-12-20 Thread Andrey Turbanov
On Tue, 12 Dec 2023 15:45:47 GMT, Per Minborg  wrote:

>> This PR proposes to change the specification for some methods that take 
>> `long` offsets so that they will throw an `IllegalArgumentException` rather 
>> than an `IndexOutOfBoundsException` for negative values.
>> 
>> The PR also proposes to fix a bug where the allocation size would overflow 
>> and the specified exception was not thrown.
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Move @throws tag

test/jdk/java/foreign/TestSegmentCopy.java line 183:

> 181: byte[] dst = new byte[] {1, 2, 3, 4};
> 182: assertThrows(IndexOutOfBoundsException.class, () ->
> 183: MemorySegment.copy(src, JAVA_BYTE, -1, dst,0, 4)

Suggestion:

MemorySegment.copy(src, JAVA_BYTE, -1, dst, 0, 4)

test/jdk/java/foreign/TestSegmentCopy.java line 186:

> 184: );
> 185: assertThrows(IndexOutOfBoundsException.class, () ->
> 186: MemorySegment.copy(src, JAVA_BYTE, 0, dst,-1, 4)

Suggestion:

MemorySegment.copy(src, JAVA_BYTE, 0, dst, -1, 4)

test/jdk/java/foreign/TestSegmentCopy.java line 189:

> 187: );
> 188: assertThrows(IndexOutOfBoundsException.class, () ->
> 189: MemorySegment.copy(src, JAVA_BYTE, 0, dst,0, -1)

Suggestion:

MemorySegment.copy(src, JAVA_BYTE, 0, dst, 0, -1)

-

PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1432545779
PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1432546057
PR Review Comment: https://git.openjdk.org/jdk/pull/17079#discussion_r1432546260


Re: RFR: 8321786: SegmentAllocator:allocateFrom(ValueLayout, MemorySegment, ValueLayout, long, long) spec mismatch in exception scenario [v7]

2023-12-12 Thread Per Minborg
> This PR proposes to change the specification for some methods that take 
> `long` offsets so that they will throw an `IllegalArgumentException` rather 
> than an `IndexOutOfBoundsException` for negative values.
> 
> The PR also proposes to fix a bug where the allocation size would overflow 
> and the specified exception was not thrown.

Per Minborg has updated the pull request incrementally with one additional 
commit since the last revision:

  Move @throws tag

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/17079/files
  - new: https://git.openjdk.org/jdk/pull/17079/files/c1407f77..115b6ea6

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=17079=06
 - incr: https://webrevs.openjdk.org/?repo=jdk=17079=05-06

  Stats: 2 lines in 1 file changed: 1 ins; 1 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/17079.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/17079/head:pull/17079

PR: https://git.openjdk.org/jdk/pull/17079