diff options
author | Angela Sheu <angelasheu.us@gmail.com> | 2017-11-13 13:39:49 -0800 |
---|---|---|
committer | Wouter van Oortmerssen <aardappel@gmail.com> | 2017-11-13 13:39:49 -0800 |
commit | 61fe2a4fac7e735b90876f7c8efa28adda2886fc (patch) | |
tree | 701c090514bb8b48ddd5b05c162a66977ddb5ea7 | |
parent | d233b38008f30cb671fe03f14963806ffcbf99cb (diff) | |
download | flatbuffers-61fe2a4fac7e735b90876f7c8efa28adda2886fc.tar.gz flatbuffers-61fe2a4fac7e735b90876f7c8efa28adda2886fc.tar.bz2 flatbuffers-61fe2a4fac7e735b90876f7c8efa28adda2886fc.zip |
Fix valid params limit exceeded for generated table constructor (#4490)
-rw-r--r-- | src/idl_gen_general.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp index d0a7c6d8..03293005 100644 --- a/src/idl_gen_general.cpp +++ b/src/idl_gen_general.cpp @@ -1182,7 +1182,9 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) { num_fields++; } } - if (has_no_struct_fields && num_fields) { + // JVM specifications restrict default constructor params to be < 255. + // Longs and doubles take up 2 units, so we set the limit to be < 127. + if (has_no_struct_fields && num_fields && num_fields < 127) { // Generate a table constructor of the form: // public static int createName(FlatBufferBuilder builder, args...) code += " public static " + GenOffsetType(struct_def) + " "; |