jdk/src/share/classes/java/beans/Introspector.java

Print this page

        

*** 682,693 **** pd = list.get(i); if (pd instanceof IndexedPropertyDescriptor) { ipd = (IndexedPropertyDescriptor)pd; if (ipd.getIndexedWriteMethod() != null) { if (igpd != null) { ! if (igpd.getIndexedPropertyType() ! == ipd.getIndexedPropertyType()) { if (ispd != null) { ispd = new IndexedPropertyDescriptor(ispd, ipd); } else { ispd = ipd; } --- 682,692 ---- pd = list.get(i); if (pd instanceof IndexedPropertyDescriptor) { ipd = (IndexedPropertyDescriptor)pd; if (ipd.getIndexedWriteMethod() != null) { if (igpd != null) { ! if (isAssignable(igpd.getIndexedPropertyType(), ipd.getIndexedPropertyType())) { if (ispd != null) { ispd = new IndexedPropertyDescriptor(ispd, ipd); } else { ispd = ipd; }
*** 701,711 **** } } } else { if (pd.getWriteMethod() != null) { if (gpd != null) { ! if (gpd.getPropertyType() == pd.getPropertyType()) { if (spd != null) { spd = new PropertyDescriptor(spd, pd); } else { spd = pd; } --- 700,710 ---- } } } else { if (pd.getWriteMethod() != null) { if (gpd != null) { ! if (isAssignable(gpd.getPropertyType(), pd.getPropertyType())) { if (spd != null) { spd = new PropertyDescriptor(spd, pd); } else { spd = pd; }
*** 804,813 **** --- 803,816 ---- properties.put(pd.getName(), pd); } } } + private static boolean isAssignable(Class<?> current, Class<?> candidate) { + return current == null ? candidate == null : current.isAssignableFrom(candidate); + } + /** * Adds the property descriptor to the indexedproperty descriptor only if the * types are the same. * * The most specific property descriptor will take precedence.