-
Bug
-
Resolution: Duplicate
-
P3
-
9
-
None
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
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
- duplicates
-
JDK-8130937 Several methods in BeanProperty return null instead of boolean value
-
- Closed
-
- relates to
-
JDK-8132153 @BeanProperty "bound" is broken
-
- Closed
-
-
JDK-8132237 [TEST] Add regression test for JDK-8131342, JDK-8131939, JDK-8132153
-
- Closed
-