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

@SwingContainer annotation: should we inherit the info?

    XMLWordPrintable

    Details

      Description

      Please run the following test example:

      import java.beans.*;
      import javax.swing.SwingContainer;

      public class SwingContainerTest {
          
          @SwingContainer(true)
          public class Base {
              protected int x;
              @BeanProperty(description = "TEST", expert = true)
              public int getX() { return x; }
              public void setX(int v) { x = v; }
          }
          
          public class Child extends Base {}
          
          private static void Test(Class<?> c) throws IntrospectionException {
              
              System.out.println("test " + c.getSimpleName() + ":");
              BeanInfo i = Introspector.getBeanInfo(c, Object.class);
              PropertyDescriptor pds[] = i.getPropertyDescriptors();
              for (PropertyDescriptor d: pds) {
                  System.out.println(d.getShortDescription() +
                          " property, isExpert = " + d.isExpert());
              }
              
              System.out.println("isContainer = " + i.getBeanDescriptor().getValue("isContainer") + "\n");
          }
          
          public static void main(String[] args) throws IntrospectionException {
              Test(Base.class);
              Test(Child.class);
          }
      }

      Output (JDK9 b77, Win 7):

      test Base:
      TEST property, isExpert = true
      isContainer = true

      test Child:
      TEST property, isExpert = true
      isContainer = null

      so the property info was inherited, the container's - was not.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: