[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: ClassCastException for char[] MetaValue creation
scott.stark@jboss.org
do-not-reply at jboss.com
Tue Aug 7 17:29:45 EDT 2007
So the testCharArray failure comes down to this conflict mentioned in the org.jboss.metadata.spi.signature.Signature.stringsToClasses comment
| //For arrays we will want to load the class, the ArrayInfoImpl generates names in an invalid format, resolve this here
| String primitiveCandidate = param.substring(index + 1);
| String componentType = primitiveArrayTypes.get(primitiveCandidate);
|
|
The same encoded names as found in primitiveArrayTypes should be going into the ArrayInfoImpl name when a primative type is the element type:
| public ArrayInfoImpl(TypeInfo componentType)
| {
| this.componentType = componentType;
| StringBuilder builder = new StringBuilder();
| builder.append("[");
| TypeInfo temp = componentType;
| while (temp.isArray())
| {
| builder.append("[");
| temp = ((ArrayInfo) temp).getComponentType();
| }
| if (temp.getClass().equals(PrimitiveInfo.class))
| {
| //builder.append(temp.getName());
| // Use the signature encoded name for the primitive element type
| String encodedName = Signature.getPrimativeArrayType(temp.getName());
| builder.append(encodedName);
| }
| else
| {
| builder.append("L").append(temp.getName()).append(";");
| }
| name = builder.toString();
| calculateHash();
| }
|
with that change, the IntrospectionArrayUnitTestCase.testCharArray passes, but the JavassistArrayUnitTestCase.testCharArray fails with the following. The JavassistArrayInfoImpl also needs to be updated. If I do that all container unit tests are passing.
| junit.framework.AssertionFailedError: expected:<JavassistArrayInfoImpl at 75843a75{name=[Lchar;}> but was:<ArrayInfoImpl at 3c1a1399{name=[C}>
| at junit.framework.Assert.fail(Assert.java:47)
| at junit.framework.Assert.failNotEquals(Assert.java:282)
| at junit.framework.Assert.assertEquals(Assert.java:64)
| at junit.framework.Assert.assertEquals(Assert.java:71)
| at org.jboss.test.classinfo.test.AbstractClassInfoTest.testBasics(AbstractClassInfoTest.java:74)
| at org.jboss.test.classinfo.test.ClassInfoArrayTest.testArray(ClassInfoArrayTest.java:96)
| at org.jboss.test.classinfo.test.ClassInfoArrayTest.testCharArray(ClassInfoArrayTest.java:52)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071748#4071748
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071748
More information about the jboss-dev-forums
mailing list