Skip to content

Commit

Permalink
[Java] Use longs for values too big to store in int
Browse files Browse the repository at this point in the history
  • Loading branch information
broekhof authored and peterbarker committed Dec 26, 2023
1 parent 6216586 commit 3f47671
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions generator/mavgen_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,20 @@ def generate_enums(basename, xml):
* ${description}
*/
public class ${name} {
${{entry: public static final int ${name} = ${value}; /* ${description} |${{param:${description}| }} */
}}
}
''', en)
''', en)

for entry in en.entry:
if entry.value > 2147483647:
t.write(f, '''
public static final long ${name} = ${value}L; /* ${description} |${{param:${description}| }} */
''', entry)
else:
t.write(f, '''
public static final int ${name} = ${value}; /* ${description} |${{param:${description}| }} */
''', entry)

t.write(f, '''
}''')
f.close()


Expand Down

0 comments on commit 3f47671

Please sign in to comment.