Buggy code:
public class SpscGrowableArrayQueue < E > extends SpscGrowableArrayQueueConsumerField < E > { private static final int MAX_LOOK_AHEAD_STEP = Integer . getInteger ( "jctools.spsc.max.lookahead.step" , 4096 ) ; private static final long P_INDEX_OFFSET ; private static final long C_INDEX_OFFSET ; private static final long REF_ARRAY_BASE ; private static final int REF_ELEMENT_SHIFT ; private static class NextHolder { final Object [ ] next ; public NextHolder ( Object [ ] next ) { } } public SpscGrowableArrayQueue ( final int maxCapacity ) { } @ SuppressWarnings ( "unchecked" ) public SpscGrowableArrayQueue ( final int initialCapacity , int maxCapacity ) { } @ Override public final Iterator < E > iterator ( ) { } @ Override public final boolean offer ( final E e ) { if ( null == e ) { throw new NullPointerException ( "Null<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>a<seq2seq4repair_space>valid<seq2seq4repair_space>element" ) ; } final E [ ] buffer = producerBuffer ; final long index = producerIndex ; final long mask = producerMask ; final long offset = SpscGrowableArrayQueue . calcElementOffset ( index , mask ) ; if ( index < ( producerLookAhead ) ) { return writeToQueue ( buffer , e , index , offset ) ; } else { final int lookAheadStep = producerLookAheadStep ; if ( lookAheadStep > 0 ) { long lookAheadElementOffset = SpscGrowableArrayQueue . calcElementOffset ( ( index + lookAheadStep ) , mask ) ; if ( null == ( SpscGrowableArrayQueue . lvElement ( buffer , lookAheadElementOffset ) ) ) { producerLookAhead = ( index + lookAheadStep ) - 1 ; return writeToQueue ( buffer , e , index , offset ) ; } else <START_BUG> if ( null != ( SpscGrowableArrayQueue . lvElement ( buffer , SpscGrowableArrayQueue . calcElementOffset ( ( index + 1 ) , mask ) ) ) ) { <END_BUG> return writeToQueue ( buffer , e , index , offset ) ; } else if ( mask == ( maxSize ) ) { return false ; } else { resize ( buffer , index , offset , maxSize , e ) ; return true ; } } else { return offerWhileWaitingForConsumerOnLastBuffer ( buffer , e , index , mask , offset , lookAheadStep ) ; } } } private boolean offerWhileWaitingForConsumerOnLastBuffer ( final E [ ] buffer , final E e , final long index , final long mask , final long offset , final int lookAheadStep ) { } private boolean writeToQueue ( final E [ ] buffer , final E e , final long index , final long offset ) { } @ SuppressWarnings ( "unchecked" ) private void resize ( final E [ ] old , final long currIndex , final long offset , final int maxCapacity , final E e ) { } @ SuppressWarnings ( "unchecked" ) @ Override public final E poll ( ) { } @ SuppressWarnings ( "unchecked" ) private E newBufferPoll ( E [ ] nextBuffer , final long index ) { } @ SuppressWarnings ( "unchecked" ) @ Override public final E peek ( ) { } @ SuppressWarnings ( "unchecked" ) private E newBufferPeek ( E [ ] nextBuffer , final long index ) { } @ Override public final int size ( ) { } private void adjustLookAheadStep ( int capacity ) { } private long lvProducerIndex ( ) { } private long lvConsumerIndex ( ) { } private void soProducerIndex ( long v ) { } private void soConsumerIndex ( long v ) { } private static final long calcElementOffset ( long index , long mask ) { } private static final void soElement ( Object [ ] buffer , long offset , Object e ) { } private static final < E > Object lvElement ( E [ ] buffer , long offset ) { } }

Fix:
if ( null == ( SpscGrowableArrayQueue . lvElement ( buffer , SpscGrowableArrayQueue . calcElementOffset ( ( index + 1 ) , mask ) ) ) ) {