Describe the bug.
Optional int64 (long) fields with defaults break the Java code generation logic here:
potentiallyBigNumber:
type: integer
format: int64
default: 2
leads to code like
private Long potentiallyBigNumber = 2;
which is invalid Java, leading to errors like
incompatible types: int cannot be converted to java.lang.Long
(Note that required fields with defaults [which don't actually made sense] work okay since they are generated as the unboxed long type and then Java automatically converts the integer constant to a long.)
(Note that the linked file isn't ideal in other ways, e.g. it doesn't escape String defaults, but that's probably a separate issue.)
Expected behavior
Should create compilable Java code. Could be e.g. 2L.
Screenshots
N/A
How to Reproduce
Create API spec as above; run modelina Java generation; try to compile resulting Java.
🖥️ Device Information [optional]
N/A
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
None
Describe the bug.
Optional int64 (long) fields with defaults break the Java code generation logic here:
leads to code like
which is invalid Java, leading to errors like
(Note that required fields with defaults [which don't actually made sense] work okay since they are generated as the unboxed
longtype and then Java automatically converts the integer constant to a long.)(Note that the linked file isn't ideal in other ways, e.g. it doesn't escape String defaults, but that's probably a separate issue.)
Expected behavior
Should create compilable Java code. Could be e.g.
2L.Screenshots
N/A
How to Reproduce
Create API spec as above; run modelina Java generation; try to compile resulting Java.
🖥️ Device Information [optional]
N/A
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
None