pholser/junit-quickcheck

API Request: Make SourceOfRandomness's delegate accessible

rohanpadhye opened this issue · 5 comments

Is it possible to make SourceOfRandomness#delegate accessible to sub-classes? Either by making the field protected or by adding a public getDelegate() method to the class. Right now, extending SourceOfRandomness is annoying because sub-classes need to carry around their own copy of a delegate (e.g. see JQF's FastSourceOfRandomness).

@rohanpadhye Thanks for this. Sounds like a reasonable idea -- will investigate.

@rohanpadhye Would a protected method delegate() on SourceOfRandomness suffice? I'm a bit reluctant to make it public -- if a non-subclass client wants a j.u.Random, there is already toJDKRandom().

Yup, a protected accessor works. It is only useful as an extension mechanism, and does not have to be exposed to the outside world.

@rohanpadhye This should be available now on 0.9-branch.

I'll probably cut a 0.9.4 release soon.

Awesome, thanks @pholser!