Commit 61fe2a4f authored by Angela Sheu's avatar Angela Sheu Committed by Wouter van Oortmerssen

Fix valid params limit exceeded for generated table constructor (#4490)

parent d233b380
...@@ -1182,7 +1182,9 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) { ...@@ -1182,7 +1182,9 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) {
num_fields++; 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: // Generate a table constructor of the form:
// public static int createName(FlatBufferBuilder builder, args...) // public static int createName(FlatBufferBuilder builder, args...)
code += " public static " + GenOffsetType(struct_def) + " "; code += " public static " + GenOffsetType(struct_def) + " ";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment