@@ -64,8 +64,9 @@ public class Reflector {
64
64
public Reflector (Class <?> clazz ) {
65
65
type = clazz ;
66
66
addDefaultConstructor (clazz );
67
- addGetMethods (clazz );
68
- addSetMethods (clazz );
67
+ Method [] classMethods = getClassMethods (clazz );
68
+ addGetMethods (classMethods );
69
+ addSetMethods (classMethods );
69
70
addFields (clazz );
70
71
readablePropertyNames = getMethods .keySet ().toArray (new String [0 ]);
71
72
writablePropertyNames = setMethods .keySet ().toArray (new String [0 ]);
@@ -83,9 +84,8 @@ private void addDefaultConstructor(Class<?> clazz) {
83
84
.findAny ().ifPresent (constructor -> this .defaultConstructor = constructor );
84
85
}
85
86
86
- private void addGetMethods (Class <?> clazz ) {
87
+ private void addGetMethods (Method [] methods ) {
87
88
Map <String , List <Method >> conflictingGetters = new HashMap <>();
88
- Method [] methods = getClassMethods (clazz );
89
89
Arrays .stream (methods ).filter (m -> m .getParameterTypes ().length == 0 && PropertyNamer .isGetter (m .getName ()))
90
90
.forEach (m -> addMethodConflict (conflictingGetters , PropertyNamer .methodToProperty (m .getName ()), m ));
91
91
resolveGetterConflicts (conflictingGetters );
@@ -134,9 +134,8 @@ private void addGetMethod(String name, Method method, boolean isAmbiguous) {
134
134
getTypes .put (name , typeToClass (returnType ));
135
135
}
136
136
137
- private void addSetMethods (Class <?> clazz ) {
137
+ private void addSetMethods (Method [] methods ) {
138
138
Map <String , List <Method >> conflictingSetters = new HashMap <>();
139
- Method [] methods = getClassMethods (clazz );
140
139
Arrays .stream (methods ).filter (m -> m .getParameterTypes ().length == 1 && PropertyNamer .isSetter (m .getName ()))
141
140
.forEach (m -> addMethodConflict (conflictingSetters , PropertyNamer .methodToProperty (m .getName ()), m ));
142
141
resolveSetterConflicts (conflictingSetters );
0 commit comments