New issue
Advanced search Search tips

Issue 670027 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Bug



Sign in to add a comment

Mojo should clarify guarantees around Java and unsigned integers

Project Member Reported by dcheng@chromium.org, Nov 30 2016

Issue description

Since Java doesn't have unsigned types, MOjo generates interfaces using the equivalent-width signed integer type.

We should document:
- What happens if negative numbers are passed to a Mojo interface that has unsigned int parameters? Do they end up being treated as-if they were unsigned internally?
- What happens if an unsigned integer is passed to Java that can't be represented in the equivalent-width signed integer type?
 

Comment 1 by yzshen@chromium.org, Nov 30 2016

Cc: roc...@chromium.org
One possible (short-term) solution that Ken and I have discussed: still map mojom unsigned types to same-width signed types, but treat any incoming value that exceeds the signed type's range as a validation failure. When sending an integer from the Java code, we also DCHECK that the value is non-negative if it corresponds to a mojom unsigned type.

WDYT?
 
Something like that certainly sounds reasonable to me.
Cc: tsepez@chromium.org
Components: -Internals>Mojo Internals>Mojo>Bindings

Comment 5 by yzshen@chromium.org, Feb 15 2018

Owner: ----
Status: Available (was: Assigned)
Cc: -roc...@chromium.org rockot@google.com

Sign in to add a comment