mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-30 23:21:38 +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
|
* @return Value representing the created vector
|
||||||
*/
|
*/
|
||||||
private Value createVector(int key, int start, int length, boolean typed, boolean fixed, Value keys) {
|
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.
|
// Figure out smallest bit width we can store this vector with.
|
||||||
int bitWidth = Math.max(WIDTH_8, widthUInBits(length));
|
int bitWidth = Math.max(WIDTH_8, widthUInBits(length));
|
||||||
int prefixElems = 1;
|
int prefixElems = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user