Commit Graph

126 Commits

Author SHA1 Message Date
Derek Bailey 72b56fd081
FlatBuffers Version 23.5.9 (#7945) 2023-05-09 09:33:30 -07:00
Derek Bailey 63b7b25289
FlatBuffers 64 for C++ (#7935)
* First working hack of adding 64-bit. Don't judge :)

* Made vector_downward work on 64 bit types

* vector_downward uses size_t, added offset64 to reflection

* cleaned up adding offset64 in parser

* Add C++ testing skeleton for 64-bit

* working test for CreateVector64

* working >2 GiB buffers

* support for large strings

* simplified CreateString<> to just provide the offset type

* generalize CreateVector template

* update test_64.afb due to upstream format change

* Added Vector64 type, which is just an alias for vector ATM

* Switch to Offset64 for Vector64

* Update for reflection bfbs output change

* Starting to add support for vector64 type in C++

* made a generic CreateVector that can handle different offsets and vector types

* Support for 32-vector with 64-addressing

* Vector64 basic builder + tests working

* basic support for json vector64 support

* renamed fields in test_64bit.fbs to better reflect their use

* working C++ vector64 builder

* Apply --annotate-sparse-vector to 64-bit tests

* Enable Vector64 for --annotate-sparse-vectors

* Merged from upstream

* Add `near_string` field for testing 32-bit offsets alongside

* keep track of where the 32-bit and 64-bit regions are for flatbufferbuilder

* move template<> outside class body for GCC

* update run.sh to build and run tests

* basic assertion for adding 64-bit offset at the wrong time

* started to separate `FlatBufferBuilder` into two classes, 1 64-bit aware, the other not

* add test for nested flatbuffer vector64, fix bug in alignment of big vectors

* fixed CreateDirect method by iterating by Offset64 first

* internal refactoring of flatbufferbuilder

* block not supported languages in the parser from using 64-bit

* evolution tests for adding a vector64 field

* conformity tests for adding/removing offset64 attributes

* ensure test is for a big buffer

* add parser error tests for `offset64` and `vector64` attributes

* add missing static that GCC only complains about

* remove stdint-uintn.h header that gets automatically added

* move 64-bit CalculateOffset internal

* fixed return size of EndVector

* various fixes on windows

* add SizeT to vector_downward

* minimze range of size changes in vector and builder

* reworked how tracking if 64-offsets are added

* Add ReturnT to EndVector

* small cleanups

* remove need for second Array definition

* combine IndirectHelpers into one definition

* started support for vector of struct

* Support for 32/64-vectors of structs + Offset64

* small cleanups

* add verification for vector64

* add sized prefix for 64-bit buffers

* add fuzzer for 64-bit

* add example of adding many vectors using a wrapper table

* run the new -bfbs-gen-embed logic on the 64-bit tests

* remove run.sh and fix cmakelist issue

* fixed bazel rules

* fixed some PR comments

* add 64-bit tests to cmakelist
2023-05-09 09:16:30 -07:00
RishabhDeep Singh 13fc75cb6b
FlatBuffers Version 23.5.8 (#7943) 2023-05-09 08:05:25 -07:00
Derek Bailey 01834de25e
FlatBuffers Version 23.3.3 (#7852) 2023-03-03 11:46:55 -08:00
Chuck Atkins 6f9ea7c23c
Add Java reflection bindings to the distribution (#7851)
The distributions for C++ and Python include the generated reflection
bindings but are currently missing from the other language packages.
This will bring the Java package generated for releases closer to
feature parity with the C++ and Python release artifacts.
2023-03-03 11:14:07 -08:00
CodeMaster7000 de9791e0a9
Update pom.xml (#7849)
Co-authored-by: Derek Bailey <derekbailey@google.com>
2023-03-02 23:47:54 -08:00
Derek Bailey ee848a02e1
FlatBuffers Version 23.1.21 (#7796) 2023-01-21 12:46:57 -08:00
Michael Le 1703662285
Flatbuffers Version 23.1.20 (#7794)
* Flatbuffers Version 23.1.20

* Fix warnings

* Fix warnings
2023-01-21 12:03:17 -08:00
Derek Bailey af9ceabeef
FlatBuffers Version 23.1.4 (#7758) 2023-01-04 15:22:46 -08:00
Derek Bailey acf39ff056
FlatBuffers Version 22.12.06 (#7702) 2022-12-06 22:54:49 -08:00
Derek Bailey 8f625561d0
FlatBuffers Version 22.11.23 (#7662) 2022-11-23 11:32:19 -08:00
Derek Bailey 9d2c04d629 FlatBuffers Version 22.11.22 2022-11-22 14:40:01 -08:00
Derek Bailey 203241ed32
FlatBuffers Version 22.10.26 (#7607) 2022-10-26 16:02:38 -07:00
Derek Bailey a54ca1e759
FlatBuffers Version 22.10.25 (#7604) 2022-10-26 00:03:49 -07:00
Dominic Battre e301702964
Make type conversions explicit. (#7595)
As Java does not support unsigned integer types, the value types
are "rounded up" (an uint32 is represented as a long) but persisted
correctly (an uint32 is persisted as 4 bytes).

This CL makes a cast operation explicit so that the compiler
does not throw warning messages.

Co-authored-by: Dominic Battre <battre@chromium.org>
Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-10-21 09:09:28 -07:00
Dominic Battre f7b734438d
Fix LongEnum definitions (#7596)
The MyGame/Example/LongEnum.java class did not compile because
Java expects an "L" suffix for literals of type long.

This CL fixes the code generation to include such a suffix.

Co-authored-by: Dominic Battre <battre@chromium.org>
2022-10-20 18:15:00 -07:00
Derek Bailey c92e78a9f8
FlatBuffers Version 22.9.29 (#7557) 2022-09-29 22:12:07 -07:00
Derek Bailey 76ddae006f
FlatBuffers Version 22.9.24 (#7547) 2022-09-27 11:55:25 -07:00
dependabot[bot] 036032373b
Bump junit from 4.13 to 4.13.1 in /java (#7526)
Bumps [junit](https://github.com/junit-team/junit4) from 4.13 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.13...r4.13.1)

---
updated-dependencies:
- dependency-name: junit:junit
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-11 19:56:51 -07:00
Nick 89dfb43f3b
Replace `bash JavaTest.sh` with `mvn test` (#7500)
* Start of mvn-ification of the test

* move to right locations

* Update the IO done in the test to read from resources / write to temp folders

* Add github workflow attempt to mvn test it instead of JavaTest.sh

* Pin the Kotlin benchmark's symlink for /java to the right location

* Inline equality assertions and format JavaTest.java

* fix android gradle source directory

Co-authored-by: Derek Bailey <derekbailey@google.com>
2022-09-11 17:46:46 -07:00
Paulo Pinheiro b901598233
[Java][Flexbuffers] Add API to add nullables into the buffer. (#7521)
Fix #7517
2022-09-10 09:13:01 -07:00
Paulo Pinheiro 4c954181cd
[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>
2022-09-01 22:04:18 -07:00
Derek Bailey 06c5c7ed0b
FlatBuffers Version 2.0.8 (#7492) 2022-08-29 20:43:36 -07:00
Derek Bailey b86387442e
Fix typos (#7483) 2022-08-26 14:35:21 -07:00
Derek Bailey b2550dbaa9
removed BSD-3-Clause license and Zlib licenses (#7073) 2022-02-02 13:12:01 -08:00
Derek Bailey e090d8da17
Fixed long cast to int in flexbufferbuilder.java (#7059) 2022-02-01 12:58:10 -08:00
taroplus 927175ea20
[Java] lookup by byteArray is giving back wrong entry (#6915) 2021-11-15 11:16:45 -08:00
Björn Harrtell 0e9d79c355
[Java] Avoid casting ByteBuffer to Buffer (#6785)
* Revert "avoiding even more NoSuchMethod exceptions (#6729)"

This reverts commit 6fb2c90d9e.

* Revert "avoiding more NoSuchMethod exceptions (#6671)"

This reverts commit 752c7b576d.

* Revert "avoiding NoSuchMethod exception (#6658)"

This reverts commit 813d3632ec.

* Use Java 8 for Kotlin Linux builds to verify
2021-08-30 15:51:06 -07:00
Kamil Rojewski 6fb2c90d9e
avoiding even more NoSuchMethod exceptions (#6729)
* avoiding more NoSuchMethod exceptions

refs #6657

* avoiding even more NoSuchMethod exceptions

refs #6657
2021-08-05 12:25:23 -07:00
jdees c0ba2870c9
Fix typo in docu (#6714)
wether => whether
2021-06-30 14:55:56 -04:00
Kamil Rojewski 752c7b576d
avoiding more NoSuchMethod exceptions (#6671)
refs #6657
2021-06-03 14:18:45 -07:00
Wouter van Oortmerssen bec23700fc Prepare for Java 2.0.1 release
see https://github.com/google/flatbuffers/pull/6658
2021-05-24 12:20:45 -07:00
Kamil Rojewski 813d3632ec
avoiding NoSuchMethod exception (#6658) 2021-05-24 11:09:45 -07:00
Samir Ahmed 54c11932fa
[Java] Flexbuffers - Negative signed object length (#6651)
* retry with correct email

* update JavaTest.java
2021-05-20 11:57:10 -07:00
Wouter van Oortmerssen 8a7d013f85 Updated main version numbers to 2.0 2021-05-10 11:14:47 -07:00
Diogo Monteiro f96d1ef744
[Java] allowing larger buffer sizes when growing a byte buffer (#6118)
Related with issue #6113.

`(old_buf_size & 0xC0000000) != 0` checks if we can duplicate old_buf_size
 and still be under 2GB (by checking if bit 30 or 31 is 1). This doesn't
allow buffers larger than 1GB.

The strategy now is to allocate a buffer with the maximum array size
when we detect that we are overflowing the 2GB.

Also changed default buffer size to 1024.
2020-09-17 11:55:24 -07:00
Paulo Pinheiro b69fc8cc95
[Java] Add support for shared strings on FlatBufferBuilder. (#6012)
Added a method FlatBufferBuilder::createSharedString that
enable string sharing for building messages on java.

The shared pool will only contains strings inserted by
this methods.
2020-07-02 12:40:56 -07:00
Paulo Pinheiro 17c1f35fa0
[FlexBuffer][Java] ReadWriteBuf and ReadBuf interface public (#5948)
Those interfaces need to be public for use cases where the user pass a buffer to FlexBuffers class that is not a ByteBuffer.

This will fix #5944
2020-06-08 09:35:51 -07:00
greenrobot Team 2eaf57778c
[Java] Grow ArrayReadWriteBuf enough to match requested capacity. (#5921)
* [Java] Grow ArrayReadWriteBuf enough to match requested capacity.

Also handle requested capacity overflowing.

* [Java] Improve readability of ArrayReadWriteBuf.requestCapacity()

* [Java] prepare testBuilderGrowth() to fail again once FlexBuffersBuilder uses ByteBufferReadWriteBuf internally, add TestFail() as a better alternative to a plain "assert false"

* [Java] Revert some test changes and extract a small string that was used more than once; one could say three times, however, it might be worthy of a discussion if the third occasion also falls into this category, as it is an independent use case and thus would work in the same way even if the value changed.

Co-authored-by: Markus <markus@greenrobot>
2020-06-04 19:48:25 -07:00
Markus Junginger c2da8d5d85
[Java][FlexBuffers] Make FlexBuffersBuilder reusable by adding clear() (#5889) (#5890) 2020-05-07 12:26:55 -07:00
Paulo Pinheiro 925fab6b15
[Java][FlexBuffers] Optimize Map access (#5735)
The original implementation of map access is very naive:
- Encode String to UTF8 byte[]
- Creates a new KeyVector
- Performs a binary search to find the key
- return value

So every access to the Map there was useless allocations of Keys and KeyVector
and complete encoding of the search key, which for most comparisons would be wasteful.

This changes completely removes the use of KeyVector and compute the key
positions on the spot. Besides that, it compares keys codepoint-by-codepoint,
avoiding unnecessary allocations and reducing encoding for most cases.

Some benchmarks result in a 2.75x speedup.
2020-03-30 13:46:42 -07:00
Wouter van Oortmerssen 6df40a2471 pre-tag version bump for 1.12
Change-Id: I84a9365e9d8a1afe333b1df85058401ffe0a6b7c
2020-03-12 15:33:39 -07:00
Paulo Pinheiro cd88e6b2aa
[Java][FlexBuffers] Abstract buffer access from ByteBuffer (#5743)
To read and build flexbuffers on Java, one needs to wrap the data
using  ByteBuffer. But for the common case of having ByteBuffers
backed by arrays, accessing from a ByteBuffer might be inefficient.

So this change introduces two interfaces: ReadBuf and ReadWriteBuf.
It allows one to read and writes data directly on an array. It also allow
 other buffer implementations to be used with flexbuffers.

Another change is that FlexBuffersBuilder backed by array allows
the buffer to grow with the increase of the message size. Something
that could not be done with ByteBuffer.
2020-02-21 11:46:40 -08:00
Paulo Pinheiro 3f677f2414 [Java][FlexBuffers] Deprecate typed vector strings due to design flaw (#5722)
* [Java][FlexBuffers] Deprecate typed vector strings due to design flaw

It will still be possible to read buffers with this type, but the
elements will be treated as FBT_KEY and will be read as null-terminated
string.

Trying to build a vector of strings as typed will throw an exception.

More information on https://github.com/google/flatbuffers/issues/5627

Also, fix another bug on strings, where long strings were not properly
aligned.

* [Java][FlexBuffers] Make FBT_VECTOR_STRING_DEPRECATED considered typed.

The logic for FlexBuffers.isVectorType() was changed
to not consider FBT_VECTOR_STRING_DEPRECATED a typed
vector, but that can lead to missinterpretation for
existing serialized data. So we are reverting.
2020-01-24 09:58:15 -08:00
dreifachstein 35daaf83d3 [Java] Replace Table.UTF8_CHARSET with StandardCharsets.UTF_8 (#5696)
StandardCharsets.UTF_8 is already used in FlexBuffersBuilder.
2020-01-06 09:28:19 -08:00
Wouter van Oortmerssen 9b13201356 Fixed warnings in FlexBuffers.java
- Missing return statement <- bug!
- Missing hashCode function.

Change-Id: I6333cac72adf8ead92ab2e6c7215650ce4571a73
2019-12-23 17:11:57 -08:00
Derek Bailey 8d5e424c65 Add ByteBuffer copy for vector of bytes in Java (#5587) 2019-10-28 09:30:31 -07:00
Idan Sheinberg 5665cfe492 [Java] byte buffer factory returned buffer capcity is used instead of the requested size (#5558)
* byte buffer factory returned buffer is used instead of the requested capacity

* byte buffer factory returned buffer is used instead of the requested capacity

* Comment fix
2019-10-17 15:11:33 -07:00
Paulo Pinheiro 842f672baf [FlexBuffers][Java] Cache size of Sized objects in FlexBuffers (#5551)
In my benchmarks it shows deserialization performance improvements of
around 7%
2019-10-03 15:56:29 -07:00
Paulo Pinheiro d4cae0a623 Fix issue #5542 (#5543)
Empty objects that inherit from Sized would try to access internal
ByteBuffer when Sized::size was called. So we add a single byte in
the empty buffer, so when size() is called it would return 0
2019-09-30 14:05:19 -07:00