--- a/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java Wed Apr 27 13:09:58 2016 +0300
+++ b/jdk/test/java/beans/Introspector/AnonymousClassBeanPropertyTest.java Thu Apr 28 19:35:09 2016 +0300
@@ -33,7 +33,7 @@
/**
* @test
- * @bug 8132973 8132732 8155013
+ * @bug 8132973 8132732 8155013 8154958
* @summary Some check for BeanProperty annotation
* @author a.stepanov
* @run main AnonymousClassBeanPropertyTest
@@ -62,6 +62,10 @@
// ---------- test cases (interfaces) ----------
+ public interface IPublic {
+ double getX();
+ }
+
private interface IGet {
double getX();
}
@@ -113,6 +117,10 @@
void setX(double a[]);
}
+ private interface IIs {
+ boolean isX();
+ }
+
// ---------- checks ----------
@@ -124,7 +132,7 @@
return ok;
}
- private static boolean checkInfo(Class<?> c, String what) {
+ private static boolean checkInfo(Class<?> c, String what, boolean checkVals) {
BeanInfo i;
try { i = Introspector.getBeanInfo(c, Object.class); }
@@ -154,6 +162,8 @@
ok &= check("visualUpdate",
(boolean) d.getValue("visualUpdate"), UPDATE);
+ if (!checkVals) { return ok; }
+
Object vals[] = (Object[]) d.getValue("enumerationValues");
if (vals == null) {
System.out.println("null enumerationValues");
@@ -210,8 +220,10 @@
(boolean) d.getValue("visualUpdate"), !UPDATE);
Object vals[] = (Object[]) d.getValue("enumerationValues");
- if (vals != null || vals.length > 0) {
- System.out.println("non-empty enumerationValues");
+ if (vals != null && vals.length > 0) {
+ System.out.println("non-empty enumerationValues:");
+ for (Object v: vals) { System.out.print(v.toString()); }
+ System.out.println();
return false;
}
@@ -228,6 +240,31 @@
//----------------------------------------------------------------------
+ // TODO: please uncomment/update after 8154958 fix
+ /*
+ IPublic testPublic = new IPublic() {
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testPublic.getClass(), "IPublic", true);
+ System.out.println("OK = " + ok);
+ passed = passed && ok;
+ */
+
+ //----------------------------------------------------------------------
+
IGet testGet = new IGet() {
@BeanProperty(
description = DESCRIPTION,
@@ -244,7 +281,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGet.getClass(), "IGet");
+ ok = checkInfo(testGet.getClass(), "IGet", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -269,7 +306,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSet.getClass(), "ISet");
+ ok = checkInfo(testSet.getClass(), "ISet", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -294,7 +331,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetByIndex.getClass(), "IGetByIndex");
+ ok = checkInfo(testGetByIndex.getClass(), "IGetByIndex", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -319,7 +356,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetByIndex.getClass(), "ISetByIndex");
+ ok = checkInfo(testSetByIndex.getClass(), "ISetByIndex", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -346,7 +383,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetArray.getClass(), "IGetArray");
+ ok = checkInfo(testGetArray.getClass(), "IGetArray", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -374,7 +411,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetArray.getClass(), "ISetArray");
+ ok = checkInfo(testSetArray.getClass(), "ISetArray", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -402,7 +439,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetBoth_1.getClass(), "IGetBoth-1");
+ ok = checkInfo(testGetBoth_1.getClass(), "IGetBoth-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -429,7 +466,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetBoth_2.getClass(), "IGetBoth-2");
+ ok = checkInfo(testGetBoth_2.getClass(), "IGetBoth-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -465,11 +502,11 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetBoth_3.getClass(), "IGetBoth-3");
+ ok = checkInfo(testGetBoth_3.getClass(), "IGetBoth-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(testGetBoth_3.getClass(), "IGetBoth-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -495,7 +532,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetBoth_1.getClass(), "ISetBoth-1");
+ ok = checkInfo(testSetBoth_1.getClass(), "ISetBoth-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -522,7 +559,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetBoth_2.getClass(), "ISetBoth-2");
+ ok = checkInfo(testSetBoth_2.getClass(), "ISetBoth-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -558,11 +595,11 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testSetBoth_3.getClass(), "ISetBoth-3");
+ ok = checkInfo(testSetBoth_3.getClass(), "ISetBoth-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(testSetBoth_3.getClass(), "ISetBoth-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -588,7 +625,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSet_1.getClass(), "IGetSet-1");
+ ok = checkInfo(testGetSet_1.getClass(), "IGetSet-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -614,7 +651,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSet_2.getClass(), "IGetSet-2");
+ ok = checkInfo(testGetSet_2.getClass(), "IGetSet-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -649,11 +686,11 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSet_3.getClass(), "IGetSet-3");
+ ok = checkInfo(testGetSet_3.getClass(), "IGetSet-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(testGetSet_3.getClass(), "IGetSet-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -679,7 +716,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetByIndex_1.getClass(), "IGetSetByIndex-1");
+ ok = checkInfo(testGetSetByIndex_1.getClass(), "IGetSetByIndex-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -705,7 +742,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetByIndex_2.getClass(), "IGetSetByIndex-2");
+ ok = checkInfo(testGetSetByIndex_2.getClass(), "IGetSetByIndex-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
@@ -744,12 +781,12 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetByIndex_3.getClass(), "IGetSetByIndex-3");
+ ok = checkInfo(testGetSetByIndex_3.getClass(), "IGetSetByIndex-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(
testGetSetByIndex_3.getClass(), "IGetSetByIndex-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
//----------------------------------------------------------------------
@@ -781,7 +818,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetBoth_1.getClass(), "IGetSetBoth-1");
+ ok = checkInfo(testGetSetBoth_1.getClass(), "IGetSetBoth-1", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -813,7 +850,7 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetBoth_2.getClass(), "IGetSetBoth-2");
+ ok = checkInfo(testGetSetBoth_2.getClass(), "IGetSetBoth-2", true);
System.out.println("OK = " + ok);
passed = passed && ok;
*/
@@ -853,14 +890,135 @@
public void addPropertyChangeListener(PropertyChangeListener l) {}
public void removePropertyChangeListener(PropertyChangeListener l) {}
};
- ok = checkInfo(testGetSetBoth_3.getClass(), "IGetSetBoth-3");
+ ok = checkInfo(testGetSetBoth_3.getClass(), "IGetSetBoth-3", true);
System.out.println("OK = " + ok);
ok2 = checkAlternativeInfo(
testGetSetBoth_3.getClass(), "IGetSetBoth-3");
System.out.println("OK = " + ok2);
- passed = passed && ok && ok2;
+ passed = passed && (ok || ok2);
*/
+ //----------------------------------------------------------------------
+
+ IIs testIs_1 = new IIs() {
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_1.getClass(), "IIs-1", false);
+ System.out.println("OK = " + ok);
+ passed = passed && ok;
+
+
+ IIs testIs_2 = new IIs() {
+
+ private boolean b;
+
+ @Override
+ public boolean isX() { return b; }
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public void setX(boolean v) { b = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_2.getClass(), "IIs-2", false);
+ System.out.println("OK = " + ok);
+ passed = passed && ok;
+
+
+ IIs testIs_3 = new IIs() {
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return false; }
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean getX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_3.getClass(), "IIs-3", false);
+ System.out.println("OK = " + ok);
+ ok2 = checkAlternativeInfo(testIs_3.getClass(), "IIs-3");
+ System.out.println("OK = " + ok2);
+ passed = passed && (ok || ok2);
+
+ // TODO: please uncomment/update after 8132973 fix
+ /*
+ IIs testIs_4 = new IIs() {
+
+ private boolean b;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return b; }
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public void setX(boolean v) { b = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ };
+ ok = checkInfo(testIs_4.getClass(), "IIs-4", false);
+ System.out.println("OK = " + ok);
+ ok2 = checkAlternativeInfo(testIs_4.getClass(), "IIs-4");
+ System.out.println("OK = " + ok2);
+ passed = passed && (ok || ok2);
+ */
+
+
+ //----------------------------------------------------------------------
+
+
if (!passed) { throw new RuntimeException("test failed"); }
System.out.println("\ntest passed");
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/beans/Introspector/InheritanceBeanPropertyTest.java Thu Apr 28 19:35:09 2016 +0300
@@ -0,0 +1,1281 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.beans.BeanInfo;
+import java.beans.BeanProperty;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyDescriptor;
+
+import java.util.Arrays;
+
+
+/**
+ * @test
+ * @bug 8132565 8155013
+ * @summary Some inheritance check for BeanProperty annotation
+ * @author a.stepanov
+ * @run main InheritanceBeanPropertyTest
+ */
+
+
+public class InheritanceBeanPropertyTest {
+
+ private final static String DESCRIPTION = "TEST";
+ private final static boolean BOUND = true;
+ private final static boolean EXPERT = false;
+ private final static boolean HIDDEN = true;
+ private final static boolean PREFERRED = false;
+ private final static boolean REQUIRED = true;
+ private final static boolean UPDATE = false;
+
+ private final static double X = java.lang.Math.PI;
+
+ private final static String
+ V_NAME = "java.lang.Math.PI",
+ V_SHORT = "PI",
+ V = Double.toString(X);
+
+ private final static String DESCRIPTION_2 = "XYZ";
+
+
+ // ---------- test cases ----------
+
+ public static class BaseGet {
+
+ private final static String TESTCASE = "base getter";
+
+ public double getX() { return X; }
+ }
+
+ public static class OverloadGet extends BaseGet {
+
+ private final static String TESTCASE = "overload getter";
+
+ private final double x[] = {X, X, X};
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX(int i) { return x[i]; } // indexed
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BaseSet {
+
+ private final static String TESTCASE = "base setter";
+
+ double u;
+ public void setX(double v) { u = v; }
+ }
+
+ public static class OverloadSet extends BaseSet {
+
+ private final static String TESTCASE = "overload setter";
+
+ private final double x[] = {X, X, X};
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(int i, double v) { x[i] = v; } // indexed
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BaseIGet {
+
+ protected final double x[] = {X, X, X};
+ public double[] getX() { return x; }
+ }
+
+ public static class OverloadIGet extends BaseIGet {
+
+ private final static String TESTCASE = "overload indexed getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX(int i) { return x[i]; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BaseISet {
+
+ protected double x[] = {X, X, X};
+ public void setX(double a[]) { x = Arrays.copyOf(a, a.length); }
+ }
+
+ public static class OverloadISet extends BaseISet {
+
+ private final static String TESTCASE = "overload indexed setter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(int i, double v) { x[i] = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class BoolGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean getX() { return false; }
+ }
+
+ public static class BoolGetIs extends BoolGet {
+
+ private final static String TESTCASE = "base boolean getter + is";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public boolean isX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+ // ----------
+
+ public static class BoolIs {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean isX() { return false; }
+ }
+
+ public static class BoolIsGet extends BoolIs {
+
+ private final static String TESTCASE = "base is + boolean getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public boolean getX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class AnnotatedGet {
+
+ private final static String TESTCASE = "annotated super getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX() { return 0.; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class OverrideAnnotatedGet extends AnnotatedGet {
+
+ private final static String TESTCASE = "override annotated getter";
+
+ @Override
+ public double getX() { return X; }
+ }
+
+ // ----------
+
+ public static class AnnotatedIs {
+
+ private final static String TESTCASE = "annotated super is";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public boolean isX() { return false; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class OverrideAnnotatedIs extends AnnotatedIs {
+
+ private final static String TESTCASE = "override annotated is";
+
+ @Override
+ public boolean isX() { return false; }
+ }
+
+ // ----------
+
+ public static class AnnotatedSet {
+
+ private final static String TESTCASE = "annotated super set";
+
+ protected double x;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(double v) { x = -v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class OverrideAnnotatedSet extends AnnotatedSet {
+
+ private final static String TESTCASE = "override annotated setter";
+
+ @Override
+ public void setX(double v) { x = v; }
+ }
+
+ // ----------
+
+ public static class AnnotatedGet2 {
+
+ protected double x;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public double getX() { return 0.; }
+ }
+
+ public static class OverrideAnnotatedGet2 extends AnnotatedGet2 {
+
+ private final static String TESTCASE = "override annotated getter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class AnnotatedGet2Ext extends AnnotatedGet2 {
+
+ private final static String TESTCASE = "extend annotated getter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class AnnotatedIs2 {
+
+ protected boolean b = false;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean isX() { return false; }
+ }
+
+ public static class OverrideAnnotatedIs2 extends AnnotatedIs2 {
+
+ private final static String TESTCASE = "override annotated is - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return b; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class AnnotatedIs2Ext extends AnnotatedIs2 {
+
+ private final static String TESTCASE = "extend annotated is - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public void setX(boolean v) { b = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class AnnotatedSet2 {
+
+ protected double x;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public void setX(double v) { x = -v; }
+ }
+
+ public static class OverrideAnnotatedSet2 extends AnnotatedSet2 {
+
+ private final static String TESTCASE = "override annotated setter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static class AnnotatedSet2Ext extends AnnotatedSet2 {
+
+ private final static String TESTCASE = "extend annotated setter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double getX() { return x; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public abstract static class AbstractGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract double getX();
+ }
+
+ public static class OverrideAbstractGet extends AbstractGet {
+
+ private final static String TESTCASE =
+ "override abstract annotated getter";
+
+ @Override
+ public double getX() { return X; }
+ }
+
+ public static class OverrideAbstractGet2 extends AbstractGet {
+
+ private final static String TESTCASE =
+ "override abstract annotated getter - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class AbstractGetExt extends AbstractGet {
+
+ private final static String TESTCASE =
+ "extend abstract annotated getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract void setX(double v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public abstract static class AbstractIs {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract boolean isX();
+ }
+
+ public static class OverrideAbstractIs extends AbstractIs {
+
+ private final static String TESTCASE =
+ "override abstract annotated is";
+
+ @Override
+ public boolean isX() { return true; }
+ }
+
+ public static class OverrideAbstractIs2 extends AbstractIs {
+
+ private final static String TESTCASE =
+ "override abstract annotated is - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return true; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+
+ public abstract static class AbstractIsExt extends AbstractIs {
+
+ private final static String TESTCASE =
+ "extend abstract annotated is";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public abstract boolean getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public abstract static class AbstractSet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract void setX(double v);
+ }
+
+ public static class OverrideAbstractSet extends AbstractSet {
+
+ private final static String TESTCASE =
+ "override abstract annotated setter";
+
+ private double x;
+
+ @Override
+ public void setX(double v) { x = v; }
+ }
+
+ public static class OverrideAbstractSet2 extends AbstractSet {
+
+ private final static String TESTCASE =
+ "override abstract annotated setter - 2";
+
+ private double x;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class AbstractSetExt extends AbstractSet {
+
+ private final static String TESTCASE =
+ "extend abstract annotated setter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract void setX(double v[]);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static abstract class AbstractGet2 {
+
+ private final static String TESTCASE = "abstract super getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract double getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public static abstract class AbstractGet2Ext extends AbstractGet2 {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public abstract void setX(double a[]);
+ }
+
+ // ----------
+
+ public static interface IGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ double getX();
+ }
+
+ public static class IGetImpl implements IGet {
+
+ private final static String TESTCASE = "implement getter interface";
+
+ @Override
+ public double getX() { return X; }
+ }
+
+ public static class IGetImpl2 implements IGet {
+
+ private final static String TESTCASE = "implement getter interface - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class IGetImpl3 implements IGet {
+
+ private final static String TESTCASE = "implement getter interface - 3";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract void setX(double v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface IIs {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public boolean isX();
+ }
+
+ public static class IIsImpl implements IIs {
+
+ private final static String TESTCASE = "implement is interface";
+
+ @Override
+ public boolean isX() { return true; }
+ }
+
+ public static class IIsImpl2 implements IIs {
+
+ private final static String TESTCASE = "implement is interface - 2";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ @Override
+ public boolean isX() { return true; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class IIsImpl3 implements IIs {
+
+ private final static String TESTCASE = "implement is interface - 3";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE)
+ public abstract void setX(boolean v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface ISet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public void setX(double v);
+ }
+
+ public static class ISetImpl implements ISet {
+
+ private final static String TESTCASE = "implement getter interface";
+
+ private double x;
+
+ @Override
+ public void setX(double v) { x = v; }
+ }
+
+ public static class ISetImpl2 implements ISet {
+
+ private final static String TESTCASE = "implement getter interface - 2";
+
+ private double x;
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public void setX(double v) { x = v; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ public abstract static class ISetImpl3 implements ISet {
+
+ private final static String TESTCASE = "implement getter interface - 3";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public abstract double getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface ISet2 {
+
+ final static String TESTCASE = "super interface - setter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public void setX(double v);
+
+ public void addPropertyChangeListener(PropertyChangeListener l);
+ public void removePropertyChangeListener(PropertyChangeListener l);
+ }
+
+ public static class ISet2Impl implements ISet2 {
+
+ private double x;
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ @Override
+ public void setX(double v) { x = v; }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static interface IGet2 {
+
+ final static String TESTCASE = "super interface - indexed getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ public double[] getX();
+
+ public void addPropertyChangeListener(PropertyChangeListener l);
+ public void removePropertyChangeListener(PropertyChangeListener l);
+ }
+
+ public static class IGet2Impl implements IGet2 {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ @Override
+ public double[] getX() { return new double[]{X, X}; }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ public static class ProtectedGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ protected double getX() { return 0.; }
+ }
+
+ public static class OverrideProtectedGet extends ProtectedGet {
+
+ final static String TESTCASE = "override protected getter";
+
+ @BeanProperty(
+ description = DESCRIPTION,
+ bound = BOUND,
+ expert = EXPERT,
+ hidden = HIDDEN,
+ preferred = PREFERRED,
+ required = REQUIRED,
+ visualUpdate = UPDATE,
+ enumerationValues = {V_NAME})
+ @Override
+ public double getX() { return X; }
+
+ public void addPropertyChangeListener(PropertyChangeListener l) {}
+ public void removePropertyChangeListener(PropertyChangeListener l) {}
+ }
+
+ // ----------
+
+ // static getter - see also JDK-8154938
+ public static class StaticGet {
+
+ @BeanProperty(
+ description = DESCRIPTION_2,
+ bound = !BOUND,
+ expert = !EXPERT,
+ hidden = !HIDDEN,
+ preferred = !PREFERRED,
+ required = !REQUIRED,
+ visualUpdate = !UPDATE)
+ public static double getProp() { return 0.; }
+ }
+
+ public static class HideStaticGet extends StaticGet {
+
+ final static String TESTCASE = "hide static getter";
+
+ public double getX() { return X; } // add to get the "default" info
+ public static double getProp() { return X; }
+ }
+
+ // TODO: if 8154938 is considered to be a real issue,
+ // create one more test case "HideStaticGet2 extends StaticGet" with an
+ // annotated getter and check the correctness of the corresponding bean info
+
+ // ---------- checks ----------
+
+ private static boolean check(String what, boolean v, boolean ref) {
+
+ boolean ok = (v == ref);
+ if (!ok) { System.out.println(
+ "invalid " + what + ": " + v + ", expected: " + ref); }
+ return ok;
+ }
+
+ private static boolean checkInfo(BeanInfo i, boolean ignoreValsCheck) {
+
+ System.out.println("checking info...");
+
+ PropertyDescriptor descriptors[] = i.getPropertyDescriptors();
+ int nd = descriptors.length;
+ if (nd != 1) {
+ System.out.println("invalid number of descriptors: " + nd);
+ return false;
+ }
+
+ PropertyDescriptor d = descriptors[0];
+
+ String descr = d.getShortDescription();
+ boolean ok = descr.equals(DESCRIPTION);
+ if (!ok) { System.out.println("invalid description: " + descr +
+ ", expected: " + DESCRIPTION); }
+
+ ok &= check("isBound", d.isBound(), BOUND);
+ ok &= check("isExpert", d.isExpert(), EXPERT);
+ ok &= check("isHidden", d.isHidden(), HIDDEN);
+ ok &= check("isPreferred", d.isPreferred(), PREFERRED);
+ ok &= check("required", (boolean) d.getValue("required"), REQUIRED);
+ ok &= check("visualUpdate",
+ (boolean) d.getValue("visualUpdate"), UPDATE);
+
+ if (ignoreValsCheck) { return ok; }
+
+ Object vals[] = (Object[]) d.getValue("enumerationValues");
+ if (vals == null) {
+ System.out.println("null enumerationValues");
+ return false;
+ }
+
+ boolean okVals = (
+ (vals.length == 3) &&
+ vals[0].toString().equals(V_SHORT) &&
+ vals[1].toString().equals(V) &&
+ vals[2].toString().equals(V_NAME));
+
+ if (!okVals) { System.out.println("invalid enumerationValues"); }
+
+ return (ok && okVals);
+ }
+
+ private static boolean checkDefault(BeanInfo i) {
+
+ System.out.println("checking default info...");
+
+ PropertyDescriptor descriptors[] = i.getPropertyDescriptors();
+ int nd = descriptors.length;
+ if (nd != 1) {
+ System.out.println("invalid number of descriptors: " + nd);
+ return false;
+ }
+
+ PropertyDescriptor d = descriptors[0];
+
+ String descr = d.getShortDescription();
+ boolean ok = descr.equals("x");
+ if (!ok) { System.out.println("invalid description: " + descr +
+ ", expected: x"); }
+
+ ok &= check("isBound", d.isBound(), false);
+ ok &= check("isExpert", d.isExpert(), false);
+ ok &= check("isHidden", d.isHidden(), false);
+ ok &= check("isPreferred", d.isPreferred(), false);
+ ok &= check("required", (boolean) d.getValue("required"), false);
+ ok &= check("visualUpdate",
+ (boolean) d.getValue("visualUpdate"), false);
+
+ Object vals[] = (Object[]) d.getValue("enumerationValues");
+ if (vals != null && vals.length > 0) {
+ System.out.println("non-empty enumerationValues");
+ ok = false;
+ }
+
+ return ok;
+ }
+
+ // do not check enumerationValues for these classes
+ private static boolean ignoreVals(Class<?> c) {
+ return (
+ c.equals(BoolGetIs.class) ||
+ c.equals(BoolIsGet.class) ||
+ c.equals(AnnotatedIs.class) ||
+ c.equals(OverrideAnnotatedIs2.class) ||
+ c.equals(AnnotatedIs2Ext.class) ||
+ c.equals(OverrideAbstractIs.class) ||
+ c.equals(OverrideAbstractIs2.class) ||
+ c.equals(AbstractIsExt.class) ||
+ c.equals(OverrideAbstractIs.class) ||
+ c.equals(IIsImpl.class) ||
+ c.equals(IIsImpl2.class) ||
+ c.equals(IIsImpl3.class)
+ );
+ }
+
+ // default property descriptor data are expected for these classes
+ private static boolean isDefault(Class<?> c) {
+ return (
+ c.equals(OverrideAnnotatedGet.class) ||
+ c.equals(OverrideAnnotatedIs.class ) ||
+ c.equals(OverrideAnnotatedSet.class) ||
+ c.equals(OverrideAbstractGet.class) ||
+ c.equals(OverrideAbstractIs.class) ||
+ c.equals(OverrideAbstractSet.class) ||
+ c.equals(IGetImpl.class) ||
+ c.equals(IIsImpl.class) ||
+ c.equals(ISetImpl.class) ||
+ c.equals(BaseGet.class) ||
+ c.equals(BaseSet.class) ||
+ c.equals(HideStaticGet.class)
+ );
+ }
+
+
+ // ---------- run test ----------
+
+ public static void main(String[] args) throws Exception {
+
+ Class<?>
+ ic1 = ISet2Impl.class.getInterfaces()[0],
+ ic2 = IGet2Impl.class.getInterfaces()[0];
+
+ Class<?> cases[] = {
+
+ OverloadGet.class,
+ OverloadGet.class.getSuperclass(),
+ OverloadSet.class,
+ OverloadSet.class.getSuperclass(),
+ OverloadIGet.class,
+ OverloadISet.class,
+
+ // TODO: uncomment/update after 8132565 fix
+ //BoolGetIs.class,
+ //BoolIsGet.class,
+ //OverrideAnnotatedGet.class,
+ //OverrideAnnotatedIs.class,
+ //OverrideAnnotatedSet.class,
+ //OverrideAnnotatedGet2.class,
+ //AnnotatedGet2Ext.class,
+ //OverrideAnnotatedIs2.class
+ //AnnotatedIs2Ext.class,
+ //OverrideAnnotatedSet2.class,
+ //AnnotatedSet2Ext.class,
+
+ OverrideAnnotatedGet.class.getSuperclass(),
+ OverrideAnnotatedIs.class.getSuperclass(),
+ OverrideAnnotatedSet.class.getSuperclass(),
+
+ // TODO: uncomment/update after 8132565 fix
+ //OverrideAbstractGet.class,
+ //OverrideAbstractGet2.class,
+ //AbstractGetExt.class,
+ //OverrideAbstractIs.class,
+ //OverrideAbstractIs2.class,
+ //AbstractIsExt.class
+ //OverrideAbstractSet.class,
+ //OverrideAbstractSet2.class,
+ //AbstractSetExt.class,
+
+ AbstractGet2Ext.class.getSuperclass(),
+ IGetImpl.class,
+ IGetImpl2.class,
+ IGetImpl3.class,
+ IIsImpl.class,
+ IIsImpl2.class,
+ IIsImpl3.class,
+ ISetImpl.class,
+ ISetImpl2.class,
+ ISetImpl3.class,
+ ic1,
+ // ic2, // TODO: uncomment/update after 8155013 fix
+ OverrideProtectedGet.class,
+ HideStaticGet.class
+ };
+
+ boolean passed = true;
+
+ for (Class<?> c: cases) {
+
+ java.lang.reflect.Field f = c.getDeclaredField("TESTCASE");
+ f.setAccessible(true);
+ String descr = f.get(c).toString();
+
+ System.out.println("\n" + c.getSimpleName() + " (" + descr + "):");
+ BeanInfo i;
+ try {
+ i = Introspector.getBeanInfo(c,
+ (c.equals(ic1) || c.equals(ic2)) ? null : Object.class);
+ }
+ catch (IntrospectionException e) { throw new RuntimeException(e); }
+
+ boolean ok;
+
+ if (isDefault(c)) {
+ ok = checkDefault(i);
+ } else {
+ ok = checkInfo(i, ignoreVals(c));
+ }
+ System.out.println(ok ? "OK" : "NOK");
+ passed = passed && ok;
+ }
+
+ if (!passed) { throw new RuntimeException("test failed"); }
+ System.out.println("\ntest passed");
+ }
+}