You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexei Zakharov (JIRA)" <ji...@apache.org> on 2006/11/23 17:28:03 UTC
[jira] Closed: (HARMONY-2289) [classlib][beans] analyzing indexed
properties
[ http://issues.apache.org/jira/browse/HARMONY-2289?page=all ]
Alexei Zakharov closed HARMONY-2289.
------------------------------------
Resolution: Fixed
closed
> [classlib][beans] analyzing indexed properties
> ----------------------------------------------
>
> Key: HARMONY-2289
> URL: http://issues.apache.org/jira/browse/HARMONY-2289
> Project: Harmony
> Issue Type: Improvement
> Components: Non-bug differences from RI
> Environment: all
> Reporter: Alexei Zakharov
>
> RI's implementation of Introspector behaves oddly during analyzing some exotic beans. Let's
> look at the following piece of code:
> ---
> import java.beans.*;
> public class TestIntrospector2 {
> public static class MyParent {
> public Integer getProp1(int i) {
> return new Integer(1);
> }
> public void setProp1(int i, Integer val) {}
> }
> public static class MyClass extends MyParent {
> public String[] getProp1() {
> return new String[2];
> }
> public void setProp1(String[] val) {}
> }
> public static void main(String[] argv) throws Exception {
> BeanInfo binfo = Introspector.getBeanInfo(MyClass.class, Object.class);
> PropertyDescriptor[] pds = binfo.getPropertyDescriptors();
> for (PropertyDescriptor pd : pds) {
> System.out.println("Name: " + pd.getName());
> System.out.println("Descriptor type: " + pd.getClass().getName());
> System.out.println("Property type: " + pd.getPropertyType());
> if (pd instanceof IndexedPropertyDescriptor) {
> System.out.println("Property indexed type: " +
> ((IndexedPropertyDescriptor)
> pd).getIndexedPropertyType());
> }
> }
> }
> }
> ---
> The output on RI is the following:
> Name: prop1
> Descriptor type: java.beans.IndexedPropertyDescriptor
> Property type: null
> Property indexed type: class java.lang.Integer
> So it identifies an indexed property here. But it is not correct since
> array accessor methods have the type that differs from the one of
> regular accessor methods. More formal: this is against the design
> patterns for indexed properties described in JavaBeans spec (ยง 8.3.3,
> pages 55-56). It was decided in the list [1] that Harmony implementation should report the regular property that has String[] type here.
> [1] http://mail-archives.apache.org/mod_mbox/incubator-harmony-dev/200611.mbox/browser
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira