@@ -69,7 +69,28 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
69
69
Collection <KCallable <?>> members = kotlinClass .getMembers ();
70
70
Map <String , PropertyDescriptor > descriptors = new LinkedHashMap <>(members .size (), 1.f );
71
71
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 ) {
73
94
74
95
if (member instanceof KProperty <?> property ) {
75
96
@@ -100,6 +121,10 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
100
121
descriptors .put (property .getName (), new PropertyDescriptor (property .getName (), getter , setter ));
101
122
}
102
123
}
124
+ }
125
+
126
+ private static void collectBasicJavaProperties (Class <?> beanClass , Map <String , PropertyDescriptor > descriptors )
127
+ throws IntrospectionException {
103
128
104
129
Class <?> javaClass = beanClass ;
105
130
do {
@@ -123,20 +148,6 @@ public BeanInfo getBeanInfo(Class<?> beanClass) throws IntrospectionException {
123
148
descriptors .put (descriptor .getName (), descriptor );
124
149
}
125
150
}
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
- };
140
151
}
141
152
142
153
@ Nullable
0 commit comments