mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-25 12:58:40 +00:00
Merge pull request #3931 from jonathantullett/java_public_access
Fix for issue #3922
This commit is contained in:
@@ -545,7 +545,7 @@ void GenEnum(EnumDef &enum_def, std::string *code_ptr) {
|
|||||||
// "too sparse". Change at will.
|
// "too sparse". Change at will.
|
||||||
static const int kMaxSparseness = 5;
|
static const int kMaxSparseness = 5;
|
||||||
if (range / static_cast<int64_t>(enum_def.vals.vec.size()) < kMaxSparseness) {
|
if (range / static_cast<int64_t>(enum_def.vals.vec.size()) < kMaxSparseness) {
|
||||||
code += "\n private static";
|
code += "\n public static";
|
||||||
code += lang_.const_decl;
|
code += lang_.const_decl;
|
||||||
code += lang_.string_type;
|
code += lang_.string_type;
|
||||||
code += "[] names = { ";
|
code += "[] names = { ";
|
||||||
@@ -568,7 +568,10 @@ void GenEnum(EnumDef &enum_def, std::string *code_ptr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Close the class
|
// Close the class
|
||||||
code += "};\n\n";
|
code += "}";
|
||||||
|
// Java does not need the closing semi-colon on class definitions.
|
||||||
|
code += (lang_.language != IDLOptions::kJava) ? ";" : "";
|
||||||
|
code += "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the function name that is able to read a value of the given type.
|
// Returns the function name that is able to read a value of the given type.
|
||||||
@@ -1126,7 +1129,10 @@ void GenStruct(StructDef &struct_def, std::string *code_ptr) {
|
|||||||
code += "); }\n";
|
code += "); }\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
code += "};\n\n";
|
code += "}";
|
||||||
|
// Java does not need the closing semi-colon on class definitions.
|
||||||
|
code += (lang_.language != IDLOptions::kJava) ? ";" : "";
|
||||||
|
code += "\n\n";
|
||||||
}
|
}
|
||||||
const LanguageParameters & lang_;
|
const LanguageParameters & lang_;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user