"alesj" wrote :
| And you're 'unlucky' that weak value is still cached under "interface
java.util.Set".
| Hence you get integer Set --> Integer component type.
|
I don't know that luck comes into it, since AFAIK java requires the
ParameterizedType to be held as a strong reference until the testCollectionUnWrap
method finishes (that is its scope of definition).
Just in case that is not true, I changed the method to ensure that a strong ref is held
| public void testCollectionUnwrap() throws Exception
| {
| Integer i1 = 123;
| Integer i2 = 123;
| Type hold = getType("Integer", Set.class);
| checkCollection(new HashSet<Integer>(), i1, i2);
| checkCollection(new HashSet<Integer>(), Set.class, i1, i2);
| checkCollection(new HashSet<Integer>(), hold, i1, i2);
|
| TestEnum one = TestEnum.ONE;
| TestEnum two = TestEnum.TWO;
| TestEnum three = TestEnum.THREE;
| checkCollection(new HashSet<TestEnum>(), one, two, three, one);
| checkCollection(new HashSet<TestEnum>(), Set.class, one, two, three,
one);
| checkCollection(new HashSet<TestEnum>(), getType("Enum",
Set.class), one, two, three, one);
|
| System.out.println(hold); // We still hold a reference
| }
|
And I still can't reproduce the problem.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190878#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...