RFR : 7129185 : (L) Add Collections.{checked|empty|unmodifiable}Navigable{Map|Set}

Mike Duigou mike.duigou at oracle.com
Tue Jun 18 23:41:51 UTC 2013


On Jun 18 2013, at 15:14 , Martin Buchholz wrote:

> Thanks for reusing the existing testing infrastructure I wrote many years ago.

Better than starting from scratch. One aspect which was a bit frustrating and required some changes was the assumption that the result of Navigable.subMap(low,high), etc. can be cast to a Navigable from the basic Map/Set types they are declared to returned. I had not overridden all of the implementations to provide Navigable results and technically I shouldn't have been required to. It seems likely that user code makes the same assumption so I did convert all of the wrappers to return Navigables.

> ---
> I'm a big fan of diversity in testing, and so I much prefer using a different random seed every time to the "reliability" of deterministic tests.

We've been pushing for fully deterministic tests lately to reduce intermittent failures. If more exhaustive testing is needed to produce the same failures as an intermittent random-based testing then hopefully we can always choose to do the additional exhaustive testing.

>  I [assume] you wanted to add repeatability support, you could easily have the test save the initial seed and provide it in case of failure.
> 
> -    static final Random rnd = new Random();
> +    static final Random rnd = new Random(8675309);
I've now changed it back to seeding with a random value, System.nanoTime(), with the seed value printed so that it can be used for reproducing failing cases.

> I don't like the removal of tests below.  Can we find some other way of handling this (perhaps by catching NotSerializableException, as I did in MOAT.java?)
>                     if (! (xxx.getCause() instanceof NotSerializableException))
> -        if (maybe(4) && s instanceof Serializable)
> -            equal2(s, serialClone(s));
> +// mduigou: I had to comment this out for the Collection wrappers which wrap
> +// unserializable sets.
> +//        if (maybe(4) && s instanceof Serializable)
> +//            equal2(s, serialClone(s));

It now catches NotSerializableException and ignores it for this specific case.

Mike


More information about the core-libs-dev mailing list