Details
-
Type:
Bug
-
Status: Open
-
Priority:
P3
-
Resolution: Unresolved
-
Affects Version/s: 9
-
Fix Version/s: tbd
-
Component/s: client-libs
-
Labels:
-
Subcomponent:
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.
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
- relates to
-
JDK-8132565 @BeanProperty: inconsistent inheritance behavior
-
- Open
-