[jboss-dev] SoftValueHashMap behaves diff then WeakValueHashMap

Ales Justin ales.justin at gmail.com
Fri Oct 31 12:25:51 EDT 2008


All over the place - vfs, cl, deployers, ...

Weird that we didn't noticed this before.
We probably might, if there were actually some tests in commons that 
checked those maps ... ;-)

Dimitris Andreadis wrote:
> Were is this needed/used?
> 
> Ales Justin wrote:
>> jboss-commons-core issue:
>>
>> SoftValueHashMap::values doesn't return expected value type:
>>
>> e.g.
>>    public void testBasicOperations() throws Exception
>>    {
>>       Map map = createMap();
>>       map.put("date1", new Date());
>>
>>       Iterable<String> keys = map.keySet();
>>       assertIterable(keys, String.class);
>>       Iterable<Date> values = map.values();
>>       assertIterable(values, Date.class);
>>    }
>>
>>    protected <T> void assertIterable(Iterable<T> iter, Class<T> clazz)
>>    {
>>       assertTrue(iter.iterator().hasNext());
>>       T next = iter.iterator().next();
>>       assertTrue("Next " + next + " is not instance of " + 
>> clazz.getName(), clazz.isInstance(next));
>>       assertNotNull(next);
>>    }
>>
>> ---
>>
>> junit.framework.AssertionFailedError: Next 
>> org.jboss.util.collection.SoftValueHashMap$SoftValueRef at 157f0dc is not 
>> instance of java.util.Date
>>     at 
>> org.jboss.test.util.test.collection.AbstractMapUnitTest.assertIterable(AbstractMapUnitTest.java:33) 
>>
>>     at 
>> org.jboss.test.util.test.collection.AbstractMapUnitTest.testBasicOperations(AbstractMapUnitTest.java:26) 
>>
>>
>> ---
>>
>> Where WeakValueHashMap works OK.
>>
>> I'll do the fix, Dimitris|Scott can you do a new release then?
>> _______________________________________________
>> jboss-development mailing list
>> jboss-development at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/jboss-development
> _______________________________________________
> jboss-development mailing list
> jboss-development at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-development
> 



More information about the jboss-development mailing list