@@ -174,9 +174,8 @@ private static Stream<MethodParameter> fromSimpleClass(Class<?> paramClass, Fiel
174174 try {
175175 Parameter parameter = field .getAnnotation (Parameter .class );
176176 boolean isNotRequired = parameter == null || !parameter .required ();
177- Annotation [] finalFieldAnnotations = fieldAnnotations ;
178177
179- if ("java.lang.Record" .equals (paramClass .getSuperclass ().getName ())) {
178+ if (paramClass . getSuperclass () != null && "java.lang.Record" .equals (paramClass .getSuperclass ().getName ())) {
180179 Method classGetRecordComponents = Class .class .getMethod ("getRecordComponents" );
181180 Object [] components = (Object []) classGetRecordComponents .invoke (paramClass );
182181
@@ -191,7 +190,7 @@ private static Stream<MethodParameter> fromSimpleClass(Class<?> paramClass, Fiel
191190 .filter (method -> method .getName ().equals (field .getName ()))
192191 .map (method -> new MethodParameter (method , -1 ))
193192 .map (methodParameter -> DelegatingMethodParameter .changeContainingClass (methodParameter , paramClass ))
194- .map (param -> new DelegatingMethodParameter (param , fieldNamePrefix + field .getName (), finalFieldAnnotations , true , isNotRequired ));
193+ .map (param -> new DelegatingMethodParameter (param , fieldNamePrefix + field .getName (), fieldAnnotations , true , isNotRequired ));
195194
196195 }
197196 else
@@ -201,7 +200,7 @@ private static Stream<MethodParameter> fromSimpleClass(Class<?> paramClass, Fiel
201200 .filter (Objects ::nonNull )
202201 .map (method -> new MethodParameter (method , -1 ))
203202 .map (methodParameter -> DelegatingMethodParameter .changeContainingClass (methodParameter , paramClass ))
204- .map (param -> new DelegatingMethodParameter (param , fieldNamePrefix + field .getName (), finalFieldAnnotations , true , isNotRequired ));
203+ .map (param -> new DelegatingMethodParameter (param , fieldNamePrefix + field .getName (), fieldAnnotations , true , isNotRequired ));
205204 }
206205 catch (IntrospectionException | NoSuchMethodException |
207206 InvocationTargetException | IllegalAccessException |
0 commit comments