mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 04:04:19 +00:00
[Java][FlexBuffers] throwing exception for untyped fixed vectors (#7507)
Untyped fixed vectors are not supported in FlexBuffers. There was an assert to check for it, but on java, asserts are optional. This change converts the assertion into a runtime exception. Fixes #7358 Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
@@ -502,7 +502,9 @@ public class FlexBuffersBuilder {
|
||||
* @return Value representing the created vector
|
||||
*/
|
||||
private Value createVector(int key, int start, int length, boolean typed, boolean fixed, Value keys) {
|
||||
assert (!fixed || typed); // typed=false, fixed=true combination is not supported.
|
||||
if (fixed & !typed)
|
||||
throw new UnsupportedOperationException("Untyped fixed vector is not supported");
|
||||
|
||||
// Figure out smallest bit width we can store this vector with.
|
||||
int bitWidth = Math.max(WIDTH_8, widthUInBits(length));
|
||||
int prefixElems = 1;
|
||||
|
||||
Reference in New Issue
Block a user