@@ -69,7 +69,28 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
6969 Collection <KCallable <?>> members = kotlinClass .getMembers ();
7070 Map <String , PropertyDescriptor > descriptors = new LinkedHashMap <>(members .size (), 1.f );
7171
72- for (KCallable <?> member : kotlinClass .getMembers ()) {
72+ collectKotlinProperties (beanClass , members , descriptors );
73+ collectBasicJavaProperties (beanClass , descriptors );
74+
75+ PropertyDescriptor [] propertyDescriptors = descriptors .values ().toArray (new PropertyDescriptor [0 ]);
76+
77+ return new SimpleBeanInfo () {
78+ @ Override
79+ public BeanDescriptor getBeanDescriptor () {
80+ return new BeanDescriptor (beanClass );
81+ }
82+
83+ @ Override
84+ public PropertyDescriptor [] getPropertyDescriptors () {
85+ return propertyDescriptors ;
86+ }
87+ };
88+ }
89+
90+ private static void collectKotlinProperties (Class <?> beanClass , Collection <KCallable <?>> members ,
91+ Map <String , PropertyDescriptor > descriptors ) throws IntrospectionException {
92+
93+ for (KCallable <?> member : members ) {
7394
7495 if (member instanceof KProperty <?> property ) {
7596
@@ -100,6 +121,10 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
100121 descriptors .put (property .getName (), new PropertyDescriptor (property .getName (), getter , setter ));
101122 }
102123 }
124+ }
125+
126+ private static void collectBasicJavaProperties (Class <?> beanClass , Map <String , PropertyDescriptor > descriptors )
127+ throws IntrospectionException {
103128
104129 Class <?> javaClass = beanClass ;
105130 do {
@@ -123,20 +148,6 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
123148 descriptors .put (descriptor .getName (), descriptor );
124149 }
125150 }
126-
127- PropertyDescriptor [] propertyDescriptors = descriptors .values ().toArray (new PropertyDescriptor [0 ]);
128-
129- return new SimpleBeanInfo () {
130- @ Override
131- public BeanDescriptor getBeanDescriptor () {
132- return new BeanDescriptor (beanClass );
133- }
134-
135- @ Override
136- public PropertyDescriptor [] getPropertyDescriptors () {
137- return propertyDescriptors ;
138- }
139- };
140151 }
141152
142153 @ Nullable
0 commit comments