Review range checking in Java
Currently in Java we do range checking immediately in field setters. However it can lead to exception for dependent fields.
struct Test
{
int8 numBits;
bit<numBits> bitField; // exception when setting bitField member before numBits member
};
Please have a look to python emitter at the solution for range check, array length check, offset check and constraint check.
Also consider to implement range check for array elements.
Note that in C++ emitters (both c++98 and c++11) the array range check is already implemented. Consider if we can move the iterating functionality to runtime.
Review range checking template data as well. Please note that range check data are used by bitmask template data as well.
Due to this issue we have to exclude language/builtin_types tests from extra arguments check with range check code enabled. DynamicBitFieldLengthBoundsTest added in #513 doesn't work with range check code enabled since Java does range checking immediately in setters.