1515 */
1616package org .springframework .data .util ;
1717
18+ import java .lang .reflect .Array ;
1819import java .lang .reflect .Method ;
1920import java .lang .reflect .Modifier ;
2021import java .util .Arrays ;
@@ -154,7 +155,7 @@ private Optional<String> getPropertyPath(List<PropertyNameDetectionStrategy> str
154155
155156 private InvocationInformation registerInvocation (Method method , Class <?> proxyType ) {
156157
157- Recorded <?> create = Modifier .isFinal (proxyType .getModifiers ()) ? new Unrecorded () : create (proxyType );
158+ Recorded <?> create = Modifier .isFinal (proxyType .getModifiers ()) ? new Unrecorded (proxyType ) : create (proxyType );
158159 InvocationInformation information = new InvocationInformation (create , method );
159160
160161 return this .information = information ;
@@ -163,7 +164,7 @@ private InvocationInformation registerInvocation(Method method, Class<?> proxyTy
163164
164165 private static final class InvocationInformation {
165166
166- private static final InvocationInformation NOT_INVOKED = new InvocationInformation (new Unrecorded (), null );
167+ private static final InvocationInformation NOT_INVOKED = new InvocationInformation (new Unrecorded (null ), null );
167168
168169 private final Recorded <?> recorded ;
169170 private final @ Nullable Method invokedMethod ;
@@ -237,7 +238,7 @@ public int hashCode() {
237238
238239 int result = ObjectUtils .nullSafeHashCode (recorded );
239240
240- result = 31 * result + ObjectUtils .nullSafeHashCode (invokedMethod );
241+ result = ( 31 * result ) + ObjectUtils .nullSafeHashCode (invokedMethod );
241242
242243 return result ;
243244 }
@@ -360,13 +361,17 @@ public interface ToMapConverter<T, S> extends Function<T, Map<?, S>> {}
360361
361362 static class Unrecorded extends Recorded <Object > {
362363
363- private Unrecorded () {
364- super (null , null );
364+ private Unrecorded (@ Nullable Class <?> type ) {
365+ super (type == null ? null : type . isPrimitive () ? getDefaultValue ( type ) : null , null );
365366 }
366367
367368 @ Override
368369 public Optional <String > getPropertyPath (List <PropertyNameDetectionStrategy > strategies ) {
369370 return Optional .empty ();
370371 }
372+
373+ private static Object getDefaultValue (Class <?> clazz ) {
374+ return Array .get (Array .newInstance (clazz , 1 ), 0 );
375+ }
371376 }
372377}
0 commit comments