The PoissonSamplerCache method:
Can now be:
This works with no other code changes but breaks binary compatibility as the return type, although a sub-interface, is different.
The solution is to create a new method:
And deprecate the old method in favour of the new one.
An alternative is to add javadoc to the current method stating that a cast to SharedStateDiscreteSampler is supported. This would have to be checked by a unit test.