Skip to content

Document the byte-array aset coercions as permissive divergences - #888

Merged
yogthos merged 1 commit into
mainfrom
docs/byte-aset-divergence
Sep 7, 2026
Merged

Document the byte-array aset coercions as permissive divergences#888
yogthos merged 1 commit into
mainfrom
docs/byte-aset-divergence

Conversation

@yogthos

@yogthos yogthos commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Follow-up from reviewing #887. jolt's byte-array store narrows an out-of-range integer (200 -> -56, -129 -> 127) and coerces a flonum index and value, the same seam every door into a byte array uses. The JVM's aset throws IllegalArgumentException on each of these, since RT.aset(byte[], int, byte) takes a Byte only; just the constructor narrows there, so (byte-array [200]) is -56 on both runtimes.

The array-backing rows added in #887 pin that contract but no known-divergences entry said the JVM does not share it. This adds two :permissive entries, one for the integer narrowing and one for the flonum index/value, with :check values recorded from both halves of the gate.

  • make documented: 48/48 machine-checked, 21 prose
  • certify (Clojure 1.12.5, JDK 26): JVM half 48 machine-checked, corpus 0 NEW / 0 stale

Closes jolt-8eef.

A store into a byte array narrows an out-of-range integer the way
Byte.byteValue() does, and coerces a flonum index (floor) and value
(truncate toward zero). The JVM's aset rejects all of these: RT.aset's
byte and int parameters take a Byte/Long only, so (aset (byte-array 2) 0
200) is "No matching method aset found taking 3 args". Only the
constructor narrows there; (byte-array [200]) is -56 on both.

PR #887's array-backing rows pin the jolt contract value for value but
nothing recorded that the JVM disagrees. Two :permissive entries now do,
one per shape, with :check values recorded from both gate halves.

Closes jolt-8eef.
@yogthos
yogthos merged commit fcfc11c into main Sep 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant