I seem to have stumbled into a mini-constellation of inter-related and
conflicting bugs between MyFaces (1.1.1) and the RI (1.1_01) around
configuring managed List properties. Perhaps someone can help me figure
out what the correct behaviour(s) should be so I can identify which are
bugs in each implementation :-)
So, given a managed bean with the following declaration:
<managed-property>
<property-name>listInstance</property-name>
<!--<property-name>instance</property-name>-->
<list-entries>
<value-class>...</value-class>
<value>#{bean1}</value>
<value>#{bean2}</value>
<value>#{bean3}</value>
</list-entries>
</managed-property>
where the bean has the following accessors/setters defined:
public Object getInstance() { ... }
public void setInstance(Object instance) { ... }
public void setListInstance(List instance) {
setInstance(instance);
}
I have to change the managed property name according to which impl. I
deploy: with MyFaces, I have to set the 'instance' property. If I try
and set 'listInstance' it behaves as though the setListInstance method
weren't defined.
With the RI, on the other hand, I have to set 'listInstance'. It throws
an exception if I try to set 'instance'. (I'm assuming that's why the
setListInstance setter alias was added in the first place).
MyFaces has the additional behaviour that, after throwing the exception,
it appears to instantiate and configure this bean a bunch more times,
but without attempting to set the 'listInstance' property again -- as if
it's marking the property invalid and ignoring it on subsequent requests
for the bean? I'm really confused about that. The bean has scope 'none'
but is only referenced by one other bean, as an injected dependency, and
that bean has session scope.
So, what is the correct method signature for a setter for a managed
property that takes a List, and why do the two impls behave so
differently? Which one is correct? (I'm fully willing to believe I'm
doing something invalid, I just can't find a combination that works in
both MyFaces and the RI).
L.