reaktivity / nukleus-maven-plugin

Nukleus Maven Plugin
Apache License 2.0
0 stars 10 forks source link

IndexOutOfBoundsException when building after calling mutator methods in wrong order #52

Closed cmebarrow closed 6 years ago

cmebarrow commented 6 years ago

The following code (when added into IntegerVariableArraysFWTest) causes the exception:

        flyweightRW.wrap(buffer, 0, buffer.capacity())
            .appendSigned16Array((short) 0)
            .appendUnsigned64Array(12L)
            .build();

The idl from which the flyweight was generated was:


        struct IntegerVariableArrays
        {
            uint8  fixed1 = 0;
            int32 lengthUnsigned64;
            int16 fixed2 = 0;
            varint32[] varint32Array;
            uint64[lengthUnsigned64] unsigned64Array = null;
            uint8 lengthSigned16;
            int16[lengthSigned16] signed16Array;
            varint64[] varint64Array;
            int8 lengthInt8;
            int32[lengthInt8] arrayWithInt8Size = null;
            int16 lengthInt16;
            int32[lengthInt16] arrayWithInt16Size = null;
        }

Exception stack trace is:

java.lang.IndexOutOfBoundsException: limit=542 is beyond maxLimit=29
    at org.reaktivity.reaktor.internal.test.types.Flyweight.checkLimit(Flyweight.java:43)
    at org.reaktivity.reaktor.internal.test.types.ArrayFW.wrap(ArrayFW.java:36)
    at org.reaktivity.reaktor.internal.test.types.inner.IntegerVariableArraysFW.wrap(IntegerVariableArraysFW.java:153)
    at org.reaktivity.reaktor.internal.test.types.inner.IntegerVariableArraysFW.wrap(IntegerVariableArraysFW.java:1)
    at org.reaktivity.reaktor.internal.test.types.Flyweight$Builder.build(Flyweight.java:76)
    at org.reaktivity.reaktor.internal.test.types.inner.IntegerVariableArraysFW$Builder.build(IntegerVariableArraysFW.java:685)
    at org.reaktivity.nukleus.maven.plugin.internal.generated.IntegerVariableArraysFWTest.shouldDefaultValuesAfterVarintArray(IntegerVariableArraysFWTest.java:176)