Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8131939

@BeanProperty "required" info is lost; data duplication for "expert" and "hidden"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
      None

      Description

      Please run:

      import java.beans.BeanInfo;
      import java.beans.BeanProperty;
      import java.beans.IntrospectionException;
      import java.beans.Introspector;
      import java.beans.PropertyDescriptor;
      import java.util.Iterator;

      public class Test {
          
          public class C {
              
              private int value;

              @BeanProperty(
                      bound = true,
                      expert = true,
                      hidden = true,
                      preferred = true,
                      required = true,
                      visualUpdate = true,
                      description = "OTHER",
                      enumerationValues = {"javax.swing.SwingConstants.EAST"}
                      )
              public void setValue(int v) { value = v; }
              public int getValue() { return value; }
          }
          
          public static void main(String[] args) throws IntrospectionException {
              
              BeanInfo i = Introspector.getBeanInfo(C.class, Object.class);
              PropertyDescriptor d = i.getPropertyDescriptors()[0];

              Iterator<String> it = d.attributeNames().asIterator();
              while (it.hasNext()) {
                  String key = it.next();
                  System.out.println(key + ": " + d.getValue(key));
              }
              
              System.out.println("---");
              System.out.println(d.isExpert());
              System.out.println(d.isHidden());
          }
      }

      Output (JDK9 b72, Win 7):

      expert: true
      visualUpdate: true
      hidden: true
      enumerationValues: [Ljava.lang.Object;@3ada9e37
      ---
      true
      true

      So:
      1. the "required" info is lost (we do not have d.isRequired() and d.getValue("required") is obviously null)
      2. the "expert" and "hidden" info is duplicated

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              serb Sergey Bylokhov
              Reporter:
              avstepan Alexander Stepanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: