<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><span data-mce-style="font-family: Helvetica;">Hello,</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">We've noticed that Introspector behavior has changed in 7u40 compared to 7u25. Here is the example to show the difference. Let's assume that we have two classes:</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; public class A {}</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; public class B extends A {}</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">And two beans:</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; public class BeanA</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; {</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; &nbsp;public void setData(A value) {}</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; &nbsp;public A getData() {return null;}</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; }</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; public class BeanB extends BeanA</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; {</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; &nbsp;public void setData(B value) {}</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; &nbsp;public B getData() {return null;}</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">&nbsp; }</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">Here BeanB overrides getData method by using covariant return type. If we run Introspector for BeanB, then 7u25 returns PropertyType of 'data' equal to 'B', while 7u40 reports it as 'A' instead. It seems, that in 7u40 (and later versions) if return type of getter method can be casted to the return type of getter with same name defined in super-class, then Introspector just uses return type of getter in parent class.</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">If I understand correctly, this change is result of following fix, which was introduced in jdk8 and then ported to 7u40:&nbsp;</span><a href="https://bugs.openjdk.java.net/browse/JDK-7189112" data-mce-href="https://bugs.openjdk.java.net/browse/JDK-7189112" data-mce-style="font-family: Helvetica;">https://bugs.openjdk.java.net/browse/JDK-7189112</a><span data-mce-style="font-family: Helvetica;">.</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">So, here is my question: is the currently observed behavior in 7u40 a desired one, which will be kept for future java updates? Should we adapt our code to such behavior or just wait for some changes in next updates? Well, overriding properties in children classes (with covariant return type change) doesn't look like a particularly good idea - and such situation was just impossible when JavaBeans spec was originally created (it wasn't possible to override getter with different return type until covariant returns were introduced in Java 5). However, current behavior looks a little counter-intuitive - we have class with pair of matching getter and setter methods, while type of property is resolved to the getter defined in base class. And, of course, such change may break some existing code while upgrading to the 7u40 (as it was in our case).</span><br data-mce-style="font-family: Helvetica;"><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">Thanks,</span><br data-mce-style="font-family: Helvetica;"><span data-mce-style="font-family: Helvetica;">Alexey</span></body></html>