[jboss-dev] SoftValueHashMap behaves diff then WeakValueHashMap

Ales Justin ales.justin at gmail.com
Mon Nov 3 04:33:51 EST 2008


I'm done with changes.
Can you please cut new release, since I need it in VFS.
And all other SoftValueHashMap users will appreciate it as well. ;-)

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