jdk/test/java/beans/Introspector/4058433/TestBeanProperty.java
changeset 31162 b4c9194f282c
parent 25566 ba387c302edd
child 32482 45ff83ee1ee9
--- a/jdk/test/java/beans/Introspector/4058433/TestBeanProperty.java	Mon Jun 01 17:46:28 2015 +0400
+++ b/jdk/test/java/beans/Introspector/4058433/TestBeanProperty.java	Tue Jun 02 19:27:06 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -20,12 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 import java.beans.BeanProperty;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.beans.PropertyDescriptor;
 import java.util.Arrays;
-/*
+
+/**
  * @test
  * @bug 4058433
  * @summary Tests the BeanProperty annotation
@@ -34,7 +36,10 @@
  */
 public class TestBeanProperty {
     public static void main(String[] args) throws Exception {
-        Class<?>[] types = {B.class, BL.class, BLF.class, E.class, H.class, P.class, VU.class, D.class, EV.class, EVL.class, EVX.class};
+        Class<?>[] types =
+                {B.class, BL.class, BLF.class, E.class, H.class, P.class,
+                 VU.class, D.class, EVD.class, EVE.class, EV.class, EVL.class,
+                 EVX.class};
         for (Class<?> type : types) {
             PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(type, "value");
             if (((B.class == type) || (BLF.class == type)) && pd.isBound()) {
@@ -77,6 +82,14 @@
                 BeanUtils.reportPropertyDescriptor(pd);
                 throw new Error("enumerationValues from another package");
             }
+            if (EVD.class == type && !isEV(pd)) {
+                BeanUtils.reportPropertyDescriptor(pd);
+                throw new Error("EV:"+ pd.getValue("enumerationValues"));
+            }
+            if (EVE.class == type && !isEV(pd)) {
+                BeanUtils.reportPropertyDescriptor(pd);
+                throw new Error("EV:"+ pd.getValue("enumerationValues"));
+            }
         }
     }
 
@@ -219,6 +232,34 @@
         }
     }
 
+    public static class EVD {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty()
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
+    public static class EVE {
+
+        private int value;
+
+        public int getValue() {
+            return value;
+        }
+
+        @BeanProperty(enumerationValues = {})
+        public void setValue(int value) {
+            this.value = value;
+        }
+    }
+
     public static class EV {
         private int value;