Hi all,

The latest version in the CVS fails on 
ClassCastException in both

TestFastTreeMap1.setUp()
and 
TestFastTreeMap.setUp()

where the proble is that the base class 
TestTreeMap
declares 

...
TreeMap map;
...

and in setUp()
the following is performed:
  map= (TreeMap) makeMap();// this one returns a FastTreeMap which is not a
TreeMap but is a SortedMap


The obvious remedy is to test for the interface (SortedMap) and
not the implementation (TreeMap)

So the declaration in TestTreeMap can be SortedMap map;

and in the TestFastTreeMap, TestFastTreeMap1

setUp()
{
   map= (SortedMap) map;
}

I remeber having a long time ago a conversation with Craig
where he rejected the idea of declaring all these classes as only 
implementing the interface , instead of inheriting the Sun's default 
implementation (which is error prone since the functionality
is achieved through delegation). 

Now somebody changed this correctly for FastTreeMap but aparently
didn't change the test code.
I see the FastHashMap is in the same old state though.

If needed I can provide the diffs that make things work for me.


Hope this helps,

Cheers,
Costin

Reply via email to