JDK-8133563 : @SwingContainer annotation: should we inherit the info?
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 9
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2015-08-13
  • Updated: 2021-07-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
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.
Comments
Targeted to 10 as an issue introduced in 8u or 9
17-02-2017

Approved by component triage team to defer
12-08-2016

9-client-defer-candidate: There is no resource to fix it in jdk9. The bug is not critical.
12-08-2016

SQE: OK to defer
12-08-2016

the situation is similar in case of user-defined bean info: import java.beans.*; public class SwingContainerTest { public static class Base {} public static class BaseBeanInfo extends SimpleBeanInfo { @Override public BeanDescriptor getBeanDescriptor() { BeanDescriptor bd = new BeanDescriptor(Base.class, null); bd.setShortDescription("XYZ"); bd.setValue("isContainer", true); return bd; } @Override public PropertyDescriptor[] getPropertyDescriptors() { return new PropertyDescriptor[0]; } @Override public EventSetDescriptor[] getEventSetDescriptors() { return new EventSetDescriptor[0]; } @Override public MethodDescriptor[] getMethodDescriptors() { return new MethodDescriptor[0]; } @Override public int getDefaultPropertyIndex() { return -1; } @Override public int getDefaultEventIndex() { return -1; } @Override public java.awt.Image getIcon(int iconKind) { return null; } } public static 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); System.out.println("description = " + i.getBeanDescriptor().getShortDescription()); 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: description = XYZ isContainer = true test Child: description = SwingContainerTest$Child isContainer = null So we do inherit the @BeanProperty info, but do not inherit @SwingContainer and @JavaBean info - that looks discrepant at first glance
13-08-2015

the same for @SwingContainer 'delegate' - "null" for Child.
13-08-2015