Mercurial > hg > openjdk > jdk8u > jdk
changeset 14419:4424a1214fee
8030123: java/beans/Introspector/Test8027648.java fails
Reviewed-by: serb, alexsch
Contributed-by: Nicholas Cull <run2000@gmail.com>
author | alexsch |
---|---|
date | Wed, 22 Apr 2015 15:00:50 +0400 |
parents | 8f6f14c0c9ce |
children | cb3a5b83571c |
files | src/share/classes/java/beans/IndexedPropertyDescriptor.java src/share/classes/java/beans/PropertyDescriptor.java |
diffstat | 2 files changed, 28 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java Mon Apr 12 20:58:08 2021 +0000 +++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java Wed Apr 22 15:00:50 2015 +0400 @@ -429,7 +429,7 @@ /** * Package-private constructor. * Merge two property descriptors. Where they conflict, give the - * second argument (y) priority over the first argumnnt (x). + * second argument (y) priority over the first argument (x). * * @param x The first (lower priority) PropertyDescriptor * @param y The second (higher priority) PropertyDescriptor @@ -437,39 +437,37 @@ IndexedPropertyDescriptor(PropertyDescriptor x, PropertyDescriptor y) { super(x,y); - if (x instanceof IndexedPropertyDescriptor) { - IndexedPropertyDescriptor ix = (IndexedPropertyDescriptor)x; - try { - Method xr = ix.getIndexedReadMethod(); - if (xr != null) { - setIndexedReadMethod(xr); - } + Method tr = null; + Method tw = null; - Method xw = ix.getIndexedWriteMethod(); - if (xw != null) { - setIndexedWriteMethod(xw); - } - } catch (IntrospectionException ex) { - // Should not happen - throw new AssertionError(ex); + if (x instanceof IndexedPropertyDescriptor) { + IndexedPropertyDescriptor ix = (IndexedPropertyDescriptor) x; + tr = ix.getIndexedReadMethod(); + tw = ix.getIndexedWriteMethod(); + } + if (y instanceof IndexedPropertyDescriptor) { + IndexedPropertyDescriptor iy = (IndexedPropertyDescriptor) y; + Method yr = iy.getIndexedReadMethod(); + if (isAssignable(tr, yr)) { + tr = yr; + } + + Method yw = iy.getIndexedWriteMethod(); + if (isAssignable(tw, yw)) { + tw = yw; } } - if (y instanceof IndexedPropertyDescriptor) { - IndexedPropertyDescriptor iy = (IndexedPropertyDescriptor)y; - try { - Method yr = iy.getIndexedReadMethod(); - if (yr != null && yr.getDeclaringClass() == getClass0()) { - setIndexedReadMethod(yr); - } - Method yw = iy.getIndexedWriteMethod(); - if (yw != null && yw.getDeclaringClass() == getClass0()) { - setIndexedWriteMethod(yw); - } - } catch (IntrospectionException ex) { - // Should not happen - throw new AssertionError(ex); + try { + if(tr != null) { + setIndexedReadMethod(tr); } + if(tw != null) { + setIndexedWriteMethod(tw); + } + } catch(IntrospectionException ex) { + // Should not happen + throw new AssertionError(ex); } }
--- a/src/share/classes/java/beans/PropertyDescriptor.java Mon Apr 12 20:58:08 2021 +0000 +++ b/src/share/classes/java/beans/PropertyDescriptor.java Wed Apr 22 15:00:50 2015 +0400 @@ -715,7 +715,7 @@ appendTo(sb, "writeMethod", this.writeMethodRef.get()); } - private boolean isAssignable(Method m1, Method m2) { + boolean isAssignable(Method m1, Method m2) { if (m1 == null) { return true; // choose second method }