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

declaring user-defined BeanInfo class static/non-static affects the bean info

XMLWordPrintable

      Please compile/run the attached code. The output will be (JDK9 b73, Ubuntu 14.04 Linux):

      description: user-defined-description
      default property index: 1
      default event index: 0
      isContainer: true
      containerDelegateuser-defined-delegate

      property descriptors:

      ---other---
      isBound: false
      isConstrained: false
      isExpert: false
      isHidden: false
      isPreferred: false
      required: false
      visualUpdate: false
      ---value---
      isBound: true
      isConstrained: true
      isExpert: true
      isHidden: true
      isPreferred: true
      required: true
      visualUpdate: true

      (as expected). Then please remove the "static" keyword from TestClassBeanInfo declaration (declaring "TestClass" static / non-static does not affect the results). The output now is invalid:

      description: StaticOrNot$TestClass
      default property index: -1
      default event index: -1
      isContainer: null
      containerDelegatenull

      property descriptors:

      ---other---
      isBound: false
      isConstrained: false
      isExpert: false
      isHidden: false
      isPreferred: false
      required: null
      visualUpdate: null
      ---value---
      isBound: false
      isConstrained: false
      isExpert: false
      isHidden: false
      isPreferred: false
      required: null
      visualUpdate: null

      - is that what expected?

      Please note also that in case if we, e.g., remove TestClassBeanInfo and TestClass from the test class (placing them to the separate files), then the result would be correct (no need in "static"). But: at the same time we'll have the same incorrect result when using jtreg.

      These static / non-static changes seemingly do not affect new bean annotations (@JavaBean, @BeanProperty, @SwingContainer).

            Unassigned Unassigned
            avstepan Alexander Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: