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>
This commit is contained in:
Dominic Battre
2022-10-21 03:15:00 +02:00
committed by GitHub
parent 5792623df4
commit f7b734438d
3 changed files with 7 additions and 4 deletions

View File

@@ -397,6 +397,10 @@ class JavaGenerator : public BaseGenerator {
code += " ";
code += namer_.Variant(ev) + " = ";
code += enum_def.ToString(ev);
if (enum_def.underlying_type.base_type == BASE_TYPE_LONG ||
enum_def.underlying_type.base_type == BASE_TYPE_ULONG) {
code += "L";
}
code += ";\n";
}