It *used* to be the case, way back when, that final methods were more likely to get inlined by the JVM and so generally ran much faster. That's far from the case now. We oughta get rid of the final restrictions.
On Sep 28, 2012, at 4:17 PM, Ernesto Carrella wrote:
> Hello everyone,
> I am in the process of unit-testing some simulation but I am having some issues with the MersenneTwisterFast.
> I am using Mockito to stub objects and I want to test the behavior of one of my classes given a very specific list of "true" and "false" returns after calling random.nextBoolean() many times.
> The problem is that MersenneTwisterFast depressingly have all its methods as final (why is that, by the way?). So it can't be stubbed. So I can't test what I want (or in fact any test that require me to control the randomizer).
> Is there any way to control the output so that MersenneTwisterFast gives me back a specific sequence?
> It would be so easy to fix if MersenneTwisterFast at least was implementing an interface (I could make a facade object delegate and that would do), but it extend directly from Object so that's not even possible.