harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-2289) [classlib][beans] analyzing indexed properties
Date Thu, 23 Nov 2006 16:28:03 GMT
     [ 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

       

Mime
View raw message