zserio icon indicating copy to clipboard operation
zserio copied to clipboard

Bitmasks based on dynamic bifield using 64-bit expression generates uncompilable Java code

Open mikir opened this issue 2 years ago • 0 comments

The following schema generates uncompilable Java code:

const uint64 NUM_BITS = 3;

bitmask bit<NUM_BITS> Permission
{
    NONE  = 000b,
    READ  = 010b,
    WRITE
};

The generated Java code fails to compile with the following error:

    [javac] Permission.java:28: error: incompatible types: BigInteger cannot be converted to int
    [javac]         value = (byte)in.readBits((int)(NUM_BITS.NUM_BITS));
    [javac]                                        ^

mikir avatar Jun 16 '22 08:06 mikir