Closed
Description
I have multiple classes that I want to convert into the DSL. Most of them work but I found a few that didn't and failed with NullPointerExceptions.
The simplest example I could come up with was:
import com.igormaznitsa.jbbp.mapper.Bin;
import com.igormaznitsa.jbbp.mapper.BinType;
public class BreakJBBPDslBuilder {
@Bin(outOrder = 1, comment = "Reserved", type = BinType.BIT_ARRAY, extra = "4")
public byte[] reserved;
}
If I then do this:
JBBPDslBuilder.Begin().AnnotatedClass(BreakJBBPDslBuilder.class).End();
I'll get a NullPointerException in the JBBPDslBuilder class on line 1936.
In this case field.bin.outBitNumber is equal to BITS_8 so it then tries to execute the this.bin.outBitNumber() method. this.bit is the field that is NULL. I went through the test suite and it looks like the this.bin field is always NULL in the tests. Is it really needed? I haven't fully understood all of the code but maybe this should've been a NULL check on field.bin?