diff --git a/jdk/src/share/classes/java/beans/PropertyDescriptor.java b/jdk/src/share/classes/java/beans/PropertyDescriptor.java index c03149c0574..0abdcad972b 100644 --- a/jdk/src/share/classes/java/beans/PropertyDescriptor.java +++ b/jdk/src/share/classes/java/beans/PropertyDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,10 +109,6 @@ public class PropertyDescriptor extends FeatureDescriptor { if (writeMethodName != null && getWriteMethod() == null) { throw new IntrospectionException("Method not found: " + writeMethodName); } - boundInitialization(beanClass); - } - - private void boundInitialization(Class beanClass) { // If this class or one of its base classes allow PropertyChangeListener, // then we assume that any properties we discover are "bound". // See Introspector.getTargetPropertyInfo() method. @@ -163,7 +159,6 @@ public class PropertyDescriptor extends FeatureDescriptor { setReadMethod(read); setWriteMethod(write); this.baseName = base; - boundInitialization(bean); } /** diff --git a/jdk/test/java/beans/Introspector/Test7192955.java b/jdk/test/java/beans/Introspector/Test7192955.java index 13e874ba719..afce427bf30 100644 --- a/jdk/test/java/beans/Introspector/Test7192955.java +++ b/jdk/test/java/beans/Introspector/Test7192955.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,17 +23,20 @@ /* * @test - * @bug 7192955 + * @bug 7192955 8000183 * @summary Tests that all properties are bound * @author Sergey Malenkov */ +import java.beans.IntrospectionException; +import java.beans.Introspector; import java.beans.PropertyChangeListener; +import java.beans.PropertyDescriptor; import java.util.List; public class Test7192955 { - public static void main(String[] args) { + public static void main(String[] args) throws IntrospectionException { if (!BeanUtils.findPropertyDescriptor(MyBean.class, "test").isBound()) { throw new Error("a simple property is not bound"); } @@ -43,6 +46,12 @@ public class Test7192955 { if (!BeanUtils.findPropertyDescriptor(MyBean.class, "readOnly").isBound()) { throw new Error("a read-only property is not bound"); } + PropertyDescriptor[] pds = Introspector.getBeanInfo(MyBean.class, BaseBean.class).getPropertyDescriptors(); + for (PropertyDescriptor pd : pds) { + if (pd.getName().equals("test") && pd.isBound()) { + throw new Error("a simple property is bound without superclass"); + } + } } public static class BaseBean {