Name: stC104175 Date: 06/20/2000
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Let's assume I've created a class called "com.mycompany.Component". The
following code:
Introspector.getBeanInfo(Class.forName("com.mycompany.Component"));
will return java.beans.BeanInfo with property descriptors for
java.awt.Component, i.e. Introspector picks up property descriptors from the
class in different package, which is wrong.
The source that I used to reproduce the problem follows:
import java.beans.*;
class Test {
static public void main(String[] args) {
try {
PropertyDescriptor[] properties = Introspector.getBeanInfo
(com.mycompany.Component.class).getPropertyDescriptors();
for (int i = 0; i < properties.length; ++i) {
System.out.println(properties[i].getName());
}
}
catch (IntrospectionException e) {
e.printStackTrace();
}
}
}
(Review ID: 106167)
======================================================================