RFR: 8319882: SequenceLayout::toString throws ArithmeticException
Maurizio Cimadamore
mcimadamore at openjdk.org
Fri Nov 10 11:08:58 UTC 2023
On Fri, 10 Nov 2023 09:31:29 GMT, Per Minborg <pminborg at openjdk.org> wrote:
> This PR proposes to fix a problem where a sequence layout contains an element of `byteSize()` zero.
Marked as reviewed by mcimadamore (Reviewer).
src/java.base/share/classes/jdk/internal/foreign/layout/SequenceLayoutImpl.java line 182:
> 180: @Override
> 181: public String toString() {
> 182: boolean max = (Long.MAX_VALUE / Math.max(1, elementLayout.byteSize())) == elemCount;
Looks good - now if you have a sequence layout whose count is Long.MAX_VALUE, but whose element layout has size 0, you also get the `*` in the toString, which I guess makes sense (as you can't have a bigger sequence layout than that).
-------------
PR Review: https://git.openjdk.org/jdk/pull/16599#pullrequestreview-1724554448
PR Review Comment: https://git.openjdk.org/jdk/pull/16599#discussion_r1389257693
More information about the core-libs-dev
mailing list