Closed bjhargrave closed 14 years ago
Comment author: rick@us.ibm.com
This can be recreated using TestGenericCollectionInjection.testGenericCollectionInjection().
NOTE: this is in the new subproject org.osgi.test.cases.blueprint.java5
There is something strange going on if you have a property named "class" and it uses a generic collection signature. I have a component with the following signature:
public void setClass(List<Class> arg1) {
setPropertyValue("classList", arg1, List.class);
}
and am setting it using the following XML:
<component id="GenericListProperty" class="org.osgi.test.cases.blueprint.java5.components.injection.GenericListInjection">
<property name="string">
<list>
<value>abc</value>
<value>def</value>
</list>
</property>
<property name="class">
<list>
<value>java.lang.String</value>
<value>org.osgi.test.cases.blueprint.java5.components.injection.GenericListInjection</value>
</list>
</property>
</component>
Which results in the error:
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'class' of bean class [org.osgi.test.cases.blueprint.java5.components.injection.GenericListInjection]: Bean property 'class' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:801) at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:651) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78) at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1276)
If I change the name of the property to "classList" this works fine. Note that there are other tests in the suite that set properties named "class". Only this variation using the generic list is failing.
Comment author: glyn.normington@springsource.com
Closing old bug.
Original bug ID: BZ#1235 From: rick@us.ibm.com Reported version: R4 V4.2