[Design the new POJO MicroContainer] - Re: UnwrapValueUnitTestCase.testCollectionUnwrap failure on
by alesj
"alesj" wrote :
| This looks like caching issue.
|
Yup, caching:
- https://jira.jboss.org/jira/browse/JBREFLECT-7
This is what's actually going on:
(code is from WeakTypeCache)
1) checkCollection(new HashSet(), getType("Integer", Set.class), i1, i2);
| protected void put(ParameterizedType type, T result)
| {
| Class<?> rawType = (Class<?>) type.getRawType();
| ClassLoader cl = SecurityActions.getClassLoader(rawType);
| Map<String, T> classLoaderCache = getClassLoaderCache(cl);
|
| synchronized (classLoaderCache)
| {
| // TODO JBMICROCONT-131 something better than toString()?
| classLoaderCache.put(type.toString(), result);
| }
| }
|
interface java.util.Set + result are now part of cache
2) checkCollection(new HashSet(), getType("Enum", Set.class), one, two, three, one);
| protected T peek(ParameterizedType type)
| {
| Class<?> rawType = (Class<?>) type.getRawType();
| ClassLoader cl = SecurityActions.getClassLoader(rawType);
| Map<String, T> classLoaderCache = getClassLoaderCache(cl);
|
| synchronized (classLoaderCache)
| {
| return classLoaderCache.get(type.toString());
| }
| }
|
And you're 'unlucky' that weak value is still cached under "interface java.util.Set".
Hence you get integer Set --> Integer component type.
So, JBMAN-38 is purely JBREFLECT-7's result.
Who's gonna bite into JBREFLECT-7, Adrian? :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190856#4190856
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190856
17 years, 4 months
[Design the new POJO MicroContainer] - Re: UnwrapValueUnitTestCase.testCollectionUnwrap failure on
by alesj
"scott.stark(a)jboss.org" wrote : The problem is in determining the component type when a java.util.Set generic is passed in. In this case its a Set[TestEnum], but the component type is determined to be java.lang.Integer.
|
| | 441 DEBUG [DefaultMetaValueFactory] unwrapCollection, type: ReflectClassInfoImpl(a)30cb4b{name=java.util.Set}
| | 441 DEBUG [DefaultMetaValueFactory] unwrapCollection, componentType: java.lang.Integer
| | 443 DEBUG [DefaultMetaValueFactory] convertValue failure(For input string: "TWO"), value=TWO, value.class: java.lang.String, typeInfo: java.lang.Integer
| |
|
| Just adding a logging statement can change the failure or even fix the problem. Its some issue with reflection on the generic element type that is suspect.
|
This looks like caching issue.
See UnwrapValueUnitTestCase::testCollectionUnwrap.
Before Enums we test Integers.
Looks like Set.class is mapped to ClassInfo who's component type is
a leftover from previous Integers testing.
I'll dig into more.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190846#4190846
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4190846
17 years, 4 months