java_gen/java_type: fix format_primitive_literal
format_primitive_literal was not returning the right value/format
for boolean.
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index e0f0680..427de95 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -53,9 +53,12 @@
signed-craziness
"""
signed, bits, cast_needed = java_primitives_info[t]
+ if t == 'boolean':
+ return "true" if bool(value) and value not in("False", "false") else "false"
+
max = (1 << bits)-1
if value > max:
- raise Exception("Value %d to large for type %s" % (value, t))
+ raise Exception("Value %s to large for type %s" % (value, t))
if signed:
max_pos = (1 << (bits-1)) - 1