Skip to content

Commit 6f7b54b

Browse files
committed
Polishing.
Move all primary interaction API into TypeInformation to prepare making all implementations package protected. Adapt all deprecated API usage in Spring Data Commons to the new one. Benchmark results look as follows: 2.7 Mode Cnt Score Error Units TypicalEntityReaderBenchmark.hasReadTarget thrpt 10 81982861,995 ± 269948,368 ops/s TypicalEntityReaderBenchmark.kotlinDataClass thrpt 10 18472975,689 ± 161234,912 ops/s TypicalEntityReaderBenchmark.kotlinDataClassWithDefaulting thrpt 10 4029631,568 ± 18990,863 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndField thrpt 10 11495517,933 ± 209269,454 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndProperty thrpt 10 11192152,036 ± 249721,563 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorArgsCreation thrpt 10 18835101,279 ± 81895,338 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedFieldAccess thrpt 10 16309896,939 ± 80376,406 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedPropertyAccess thrpt 10 15471691,537 ± 52426,121 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorAndField thrpt 10 12080159,283 ± 49922,326 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorAndProperty thrpt 10 12166160,066 ± 173876,051 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorArgsCreation thrpt 10 13548906,437 ± 485944,886 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveFieldAccess thrpt 10 16457347,670 ± 64170,567 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccess thrpt 10 14115878,948 ± 57491,268 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccessWithCustomConversionRegistry thrpt 10 15137904,257 ± 51148,726 ops/s DefaultTypeMapperBenchmark.readTyped thrpt 10 146820080,682 ± 13254238,407 ops/s DefaultTypeMapperBenchmark.readTypedWithBaseType thrpt 10 55420351,827 ± 1888634,217 ops/s DefaultTypeMapperBenchmark.readUntyped thrpt 10 193934847,273 ± 442867,276 ops/s DefaultTypeMapperBenchmark.readUntypedWithBaseType thrpt 10 192032977,366 ± 4300192,665 ops/s 3.0 – Before this change Mode Cnt Score Error Units TypicalEntityReaderBenchmark.hasReadTarget thrpt 10 81124249,138 ± 174095,495 ops/s TypicalEntityReaderBenchmark.kotlinDataClass thrpt 10 18685936,220 ± 243939,063 ops/s TypicalEntityReaderBenchmark.kotlinDataClassWithDefaulting thrpt 10 4125709,048 ± 17615,890 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndField thrpt 10 12277837,989 ± 96973,908 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndProperty thrpt 10 12419978,391 ± 45780,658 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorArgsCreation thrpt 10 18744593,010 ± 71655,735 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedFieldAccess thrpt 10 16497286,465 ± 41150,718 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedPropertyAccess thrpt 10 15639640,554 ± 69758,391 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorAndField thrpt 10 11715068,503 ± 66085,900 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorAndProperty thrpt 10 12159285,083 ± 58171,950 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorArgsCreation thrpt 10 13711647,512 ± 66496,271 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveFieldAccess thrpt 10 16287057,838 ± 54826,532 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccess thrpt 10 13847665,634 ± 127834,292 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccessWithCustomConversionRegistry thrpt 10 15099300,270 ± 89030,403 ops/s DefaultTypeMapperBenchmark.readTyped thrpt 10 151893972,774 ± 494555,250 ops/s DefaultTypeMapperBenchmark.readTypedWithBaseType thrpt 10 55869432,892 ± 389099,409 ops/s DefaultTypeMapperBenchmark.readUntyped thrpt 10 192661151,755 ± 1075079,924 ops/s DefaultTypeMapperBenchmark.readUntypedWithBaseType thrpt 10 192315554,269 ± 3061160,314 ops/s 3.0 – After this change Mode Cnt Score Error Units TypicalEntityReaderBenchmark.hasReadTarget thrpt 10 82650245,236 ± 321384,577 ops/s TypicalEntityReaderBenchmark.kotlinDataClass thrpt 10 21304680,430 ± 396764,834 ops/s TypicalEntityReaderBenchmark.kotlinDataClassWithDefaulting thrpt 10 4422187,275 ± 35088,721 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndField thrpt 10 13345503,496 ± 180490,423 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorAndProperty thrpt 10 13911653,366 ± 266028,886 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedConstructorArgsCreation thrpt 10 21192316,261 ± 356534,938 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedFieldAccess thrpt 10 17533419,173 ± 49226,408 ops/s TypicalEntityReaderBenchmark.simpleEntityGeneratedPropertyAccess thrpt 10 17393382,078 ± 114774,442 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorAndField thrpt 10 12867285,952 ± 62870,980 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorAndProperty thrpt 10 13208453,130 ± 272795,070 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveConstructorArgsCreation thrpt 10 14998467,714 ± 84265,782 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectiveFieldAccess thrpt 10 17365982,413 ± 115287,403 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccess thrpt 10 15503841,949 ± 123631,592 ops/s TypicalEntityReaderBenchmark.simpleEntityReflectivePropertyAccessWithCustomConversionRegistry thrpt 10 15716685,449 ± 64686,646 ops/s DefaultTypeMapperBenchmark.readTyped thrpt 10 154433835,941 ± 1391455,835 ops/s DefaultTypeMapperBenchmark.readTypedWithBaseType thrpt 10 77919886,633 ± 438244,738 ops/s DefaultTypeMapperBenchmark.readUntyped thrpt 10 194435210,217 ± 936274,571 ops/s DefaultTypeMapperBenchmark.readUntypedWithBaseType thrpt 10 193768718,043 ± 475103,167 ops/s Original pull request: #2572. Related ticket: #2312.
1 parent 1d6331c commit 6f7b54b

File tree

60 files changed

+645
-656
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+645
-656
lines changed

Diff for: src/main/java/org/springframework/data/convert/ConfigurableTypeInformationMapper.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import org.springframework.data.mapping.Alias;
2323
import org.springframework.data.mapping.PersistentEntity;
2424
import org.springframework.data.mapping.context.MappingContext;
25-
import org.springframework.data.util.ClassTypeInformation;
2625
import org.springframework.data.util.TypeInformation;
2726
import org.springframework.lang.Nullable;
2827
import org.springframework.util.Assert;
@@ -37,8 +36,8 @@
3736
*/
3837
public class ConfigurableTypeInformationMapper implements TypeInformationMapper {
3938

40-
private final Map<ClassTypeInformation<?>, Alias> typeToAlias;
41-
private final Map<Alias, ClassTypeInformation<?>> aliasToType;
39+
private final Map<TypeInformation<?>, Alias> typeToAlias;
40+
private final Map<Alias, TypeInformation<?>> aliasToType;
4241

4342
/**
4443
* Creates a new {@link ConfigurableTypeInformationMapper} for the given type map.
@@ -54,7 +53,7 @@ public ConfigurableTypeInformationMapper(Map<? extends Class<?>, String> sourceT
5453

5554
for (Entry<? extends Class<?>, String> entry : sourceTypeMap.entrySet()) {
5655

57-
ClassTypeInformation<?> type = ClassTypeInformation.from(entry.getKey());
56+
TypeInformation<?> type = TypeInformation.of(entry.getKey());
5857
Alias alias = Alias.of(entry.getValue());
5958

6059
if (typeToAlias.containsValue(alias)) {

Diff for: src/main/java/org/springframework/data/convert/DefaultTypeMapper.java

+5-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.springframework.data.mapping.Alias;
2828
import org.springframework.data.mapping.PersistentEntity;
2929
import org.springframework.data.mapping.context.MappingContext;
30-
import org.springframework.data.util.ClassTypeInformation;
3130
import org.springframework.data.util.TypeInformation;
3231
import org.springframework.lang.Nullable;
3332
import org.springframework.util.Assert;
@@ -149,16 +148,16 @@ public <T> TypeInformation<? extends T> readType(S source, TypeInformation<T> ba
149148

150149
Class<T> rawType = basicType.getType();
151150

152-
boolean isMoreConcreteCustomType = rawType == null
153-
|| rawType.isAssignableFrom(documentsTargetType) && !rawType.equals(documentsTargetType);
151+
boolean isMoreConcreteCustomType = (rawType == null)
152+
|| (rawType.isAssignableFrom(documentsTargetType) && !rawType.equals(documentsTargetType));
154153

155154
if (!isMoreConcreteCustomType) {
156155
return basicType;
157156
}
158157

159-
ClassTypeInformation<?> targetType = ClassTypeInformation.from(documentsTargetType);
158+
TypeInformation<?> targetType = TypeInformation.of(documentsTargetType);
160159

161-
return (TypeInformation<? extends T>) basicType.specialize(targetType);
160+
return basicType.specialize(targetType);
162161
}
163162

164163
/**
@@ -190,7 +189,7 @@ protected TypeInformation<?> getFallbackTypeFor(S source) {
190189

191190
@Override
192191
public void writeType(Class<?> type, S dbObject) {
193-
writeType(ClassTypeInformation.from(type), dbObject);
192+
writeType(TypeInformation.of(type), dbObject);
194193
}
195194

196195
@Override

Diff for: src/main/java/org/springframework/data/convert/SimpleTypeInformationMapper.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.springframework.beans.factory.BeanClassLoaderAware;
2323
import org.springframework.data.mapping.Alias;
24-
import org.springframework.data.util.ClassTypeInformation;
2524
import org.springframework.data.util.TypeInformation;
2625
import org.springframework.lang.Nullable;
2726
import org.springframework.util.ClassUtils;
@@ -36,7 +35,7 @@
3635
*/
3736
public class SimpleTypeInformationMapper implements TypeInformationMapper, BeanClassLoaderAware {
3837

39-
private final Map<String, Optional<ClassTypeInformation<?>>> cache = new ConcurrentHashMap<>();
38+
private final Map<String, Optional<TypeInformation<?>>> cache = new ConcurrentHashMap<>();
4039

4140
private @Nullable ClassLoader classLoader;
4241

@@ -79,10 +78,10 @@ public void setBeanClassLoader(ClassLoader classLoader) {
7978
this.classLoader = classLoader;
8079
}
8180

82-
private Optional<ClassTypeInformation<?>> loadClass(String typeName) {
81+
private Optional<TypeInformation<?>> loadClass(String typeName) {
8382

8483
try {
85-
return Optional.of(ClassTypeInformation.from(ClassUtils.forName(typeName, this.classLoader)));
84+
return Optional.of(TypeInformation.of(ClassUtils.forName(typeName, this.classLoader)));
8685
} catch (ClassNotFoundException e) {
8786
return Optional.empty();
8887
}

Diff for: src/main/java/org/springframework/data/convert/ValueConversionContext.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ default Object write(@Nullable Object value) {
6969
*/
7070
@Nullable
7171
default <T> T write(@Nullable Object value, @NonNull Class<T> target) {
72-
return write(value, ClassTypeInformation.from(target));
72+
return write(value, TypeInformation.of(target));
7373
}
7474

7575
/**
@@ -119,7 +119,7 @@ default Object read(@Nullable Object value) {
119119
*/
120120
@Nullable
121121
default <T> T read(@Nullable Object value, @NonNull Class<T> target) {
122-
return read(value, ClassTypeInformation.from(target));
122+
return read(value, TypeInformation.of(target));
123123
}
124124

125125
/**

Diff for: src/main/java/org/springframework/data/mapping/PropertyPath.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public class PropertyPath implements Streamable<PropertyPath> {
6868
* @param owningType must not be {@literal null}.
6969
*/
7070
PropertyPath(String name, Class<?> owningType) {
71-
this(name, ClassTypeInformation.from(owningType), Collections.emptyList());
71+
this(name, TypeInformation.of(owningType), Collections.emptyList());
7272
}
7373

7474
/**
@@ -315,7 +315,7 @@ private PropertyPath requiredNext() {
315315
* @return
316316
*/
317317
public static PropertyPath from(String source, Class<?> type) {
318-
return from(source, ClassTypeInformation.from(type));
318+
return from(source, TypeInformation.of(type));
319319
}
320320

321321
/**

Diff for: src/main/java/org/springframework/data/mapping/context/AbstractMappingContext.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ public Collection<E> getPersistentEntities() {
189189

190190
@Nullable
191191
public E getPersistentEntity(Class<?> type) {
192-
return getPersistentEntity(ClassTypeInformation.from(type));
192+
return getPersistentEntity(TypeInformation.of(type));
193193
}
194194

195195
@Override
196196
public boolean hasPersistentEntityFor(Class<?> type) {
197197

198198
Assert.notNull(type, "Type must not be null");
199199

200-
TypeInformation<?> typeInformation = ClassTypeInformation.from(type);
200+
TypeInformation<?> typeInformation = TypeInformation.of(type);
201201

202202
try {
203203

@@ -312,7 +312,7 @@ public <T> PersistentPropertyPaths<T, P> findPersistentPropertyPaths(Class<T> ty
312312
*/
313313
protected final <T> PersistentPropertyPaths<T, P> doFindPersistentPropertyPaths(Class<T> type,
314314
Predicate<? super P> predicate, Predicate<P> traversalGuard) {
315-
return persistentPropertyPathFactory.from(ClassTypeInformation.from(type), predicate, traversalGuard);
315+
return persistentPropertyPathFactory.from(TypeInformation.of(type), predicate, traversalGuard);
316316
}
317317

318318
/**
@@ -322,7 +322,7 @@ protected final <T> PersistentPropertyPaths<T, P> doFindPersistentPropertyPaths(
322322
* @return
323323
*/
324324
protected Optional<E> addPersistentEntity(Class<?> type) {
325-
return addPersistentEntity(ClassTypeInformation.from(type));
325+
return addPersistentEntity(TypeInformation.of(type));
326326
}
327327

328328
/**
@@ -728,7 +728,7 @@ static class PropertyMatch {
728728
*/
729729
public PropertyMatch(@Nullable String namePattern, @Nullable String typeName) {
730730

731-
Assert.isTrue(!(namePattern == null && typeName == null), "Either name pattern or type name must be given");
731+
Assert.isTrue(!((namePattern == null) && (typeName == null)), "Either name pattern or type name must be given");
732732

733733
this.namePattern = namePattern;
734734
this.typeName = typeName;
@@ -746,11 +746,11 @@ public boolean matches(String name, Class<?> type) {
746746
Assert.notNull(name, "Name must not be null");
747747
Assert.notNull(type, "Type must not be null");
748748

749-
if (namePattern != null && !name.matches(namePattern)) {
749+
if ((namePattern != null) && !name.matches(namePattern)) {
750750
return false;
751751
}
752752

753-
if (typeName != null && !type.getName().equals(typeName)) {
753+
if ((typeName != null) && !type.getName().equals(typeName)) {
754754
return false;
755755
}
756756

Diff for: src/main/java/org/springframework/data/mapping/context/PersistentPropertyPathFactory.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public PersistentPropertyPath<P> from(Class<?> type, String propertyPath) {
6868
Assert.notNull(type, "Type must not be null");
6969
Assert.notNull(propertyPath, "Property path must not be null");
7070

71-
return getPersistentPropertyPath(ClassTypeInformation.from(type), propertyPath);
71+
return getPersistentPropertyPath(TypeInformation.of(type), propertyPath);
7272
}
7373

7474
/**
@@ -112,7 +112,7 @@ public <T> PersistentPropertyPaths<T, P> from(Class<T> type, Predicate<? super P
112112
Assert.notNull(type, "Type must not be null");
113113
Assert.notNull(propertyFilter, "Property filter must not be null");
114114

115-
return from(ClassTypeInformation.from(type), propertyFilter);
115+
return from(TypeInformation.of(type), propertyFilter);
116116
}
117117

118118
/**
@@ -131,7 +131,7 @@ public <T> PersistentPropertyPaths<T, P> from(Class<T> type, Predicate<? super P
131131
Assert.notNull(propertyFilter, "Property filter must not be null");
132132
Assert.notNull(traversalGuard, "Traversal guard must not be null");
133133

134-
return from(ClassTypeInformation.from(type), propertyFilter, traversalGuard);
134+
return from(TypeInformation.of(type), propertyFilter, traversalGuard);
135135
}
136136

137137
/**

Diff for: src/main/java/org/springframework/data/mapping/model/AnnotationBasedPersistentProperty.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public abstract class AnnotationBasedPersistentProperty<P extends PersistentProp
8888
return Optional.of(Reference.class) //
8989
.map(this::findAnnotation) //
9090
.map(Reference::to) //
91-
.map(it -> !Class.class.equals(it) ? ClassTypeInformation.from(it) : getActualTypeInformation()) //
91+
.map(it -> !Class.class.equals(it) ? TypeInformation.of(it) : getActualTypeInformation()) //
9292
.orElseGet(() -> super.getAssociationTargetTypeInformation());
9393
});
9494

Diff for: src/main/java/org/springframework/data/mapping/model/PreferredConstructorDiscoverer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static <T, P extends PersistentProperty<P>> PreferredConstructor<T, P> discover(
6363
Assert.notNull(type, "Type must not be null");
6464

6565
return Discoverers.findDiscoverer(type) //
66-
.discover(ClassTypeInformation.from(type), null);
66+
.discover(TypeInformation.of(type), null);
6767
}
6868

6969
/**

Diff for: src/main/java/org/springframework/data/projection/EntityProjection.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import java.util.function.Consumer;
2525

2626
import org.springframework.data.mapping.PropertyPath;
27-
import org.springframework.data.util.ClassTypeInformation;
2827
import org.springframework.data.util.Streamable;
2928
import org.springframework.data.util.TypeInformation;
3029
import org.springframework.lang.Nullable;
@@ -37,6 +36,7 @@
3736
* @param <D> the domain type.
3837
* @author Mark Paluch
3938
* @author Christoph Strobl
39+
* @author Oliver Drotbohm
4040
* @since 2.7
4141
*/
4242
public class EntityProjection<M, D> implements Streamable<EntityProjection.PropertyProjection<?, ?>> {
@@ -90,7 +90,9 @@ public static <M, D> EntityProjection<M, D> nonProjecting(TypeInformation<M> map
9090
* @return new instance of {@link EntityProjection}.
9191
*/
9292
public static <T> EntityProjection<T, T> nonProjecting(Class<T> type) {
93-
ClassTypeInformation<T> typeInformation = ClassTypeInformation.from(type);
93+
94+
TypeInformation<T> typeInformation = TypeInformation.of(type);
95+
9496
return new EntityProjection<>(typeInformation, typeInformation, Collections.emptyList(), false,
9597
ProjectionType.CLOSED);
9698
}

Diff for: src/main/java/org/springframework/data/projection/EntityProjectionIntrospector.java

+10-7
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@
2525
import org.springframework.data.mapping.PersistentEntity;
2626
import org.springframework.data.mapping.PersistentProperty;
2727
import org.springframework.data.mapping.PropertyPath;
28-
import org.springframework.data.projection.EntityProjection.ProjectionType;
2928
import org.springframework.data.mapping.context.MappingContext;
30-
import org.springframework.data.util.ClassTypeInformation;
29+
import org.springframework.data.projection.EntityProjection.ProjectionType;
3130
import org.springframework.data.util.TypeInformation;
3231
import org.springframework.lang.Nullable;
3332
import org.springframework.util.Assert;
@@ -39,6 +38,7 @@
3938
* @author Gerrit Meier
4039
* @author Mark Paluch
4140
* @author Christoph Strobl
41+
* @author Oliver Drotbohm
4242
* @since 2.7
4343
*/
4444
public class EntityProjectionIntrospector {
@@ -91,8 +91,8 @@ public static EntityProjectionIntrospector create(ProjectionFactory projectionFa
9191
*/
9292
public <M, D> EntityProjection<M, D> introspect(Class<M> mappedType, Class<D> domainType) {
9393

94-
ClassTypeInformation<M> returnedTypeInformation = ClassTypeInformation.from(mappedType);
95-
ClassTypeInformation<D> domainTypeInformation = ClassTypeInformation.from(domainType);
94+
TypeInformation<M> returnedTypeInformation = TypeInformation.of(mappedType);
95+
TypeInformation<D> domainTypeInformation = TypeInformation.of(domainType);
9696

9797
boolean isProjection = projectionPredicate.test(mappedType, domainType);
9898

@@ -111,7 +111,8 @@ public <M, D> EntityProjection<M, D> introspect(Class<M> mappedType, Class<D> do
111111
List<EntityProjection.PropertyProjection<?, ?>> propertyDescriptors = getProperties(null, projectionInformation,
112112
returnedTypeInformation, persistentEntity, null);
113113

114-
return EntityProjection.projecting(returnedTypeInformation, domainTypeInformation, propertyDescriptors, ProjectionType.CLOSED);
114+
return EntityProjection.projecting(returnedTypeInformation, domainTypeInformation, propertyDescriptors,
115+
ProjectionType.CLOSED);
115116
}
116117

117118
private List<EntityProjection.PropertyProjection<?, ?>> getProperties(@Nullable PropertyPath propertyPath,
@@ -157,10 +158,12 @@ public <M, D> EntityProjection<M, D> introspect(Class<M> mappedType, Class<D> do
157158

158159
if (container) {
159160
propertyDescriptors.add(EntityProjection.ContainerPropertyProjection.projecting(nestedPropertyPath, property,
160-
persistentProperty.getTypeInformation(), nestedPropertyDescriptors, ProjectionType.from(projectionInformation)));
161+
persistentProperty.getTypeInformation(), nestedPropertyDescriptors,
162+
ProjectionType.from(projectionInformation)));
161163
} else {
162164
propertyDescriptors.add(EntityProjection.PropertyProjection.projecting(nestedPropertyPath, property,
163-
persistentProperty.getTypeInformation(), nestedPropertyDescriptors, ProjectionType.from(projectionInformation)));
165+
persistentProperty.getTypeInformation(), nestedPropertyDescriptors,
166+
ProjectionType.from(projectionInformation)));
164167
}
165168

166169
} else {

Diff for: src/main/java/org/springframework/data/projection/ProjectingMethodInterceptor.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525

2626
import org.aopalliance.intercept.MethodInterceptor;
2727
import org.aopalliance.intercept.MethodInvocation;
28-
2928
import org.springframework.core.CollectionFactory;
3029
import org.springframework.core.convert.ConversionService;
31-
import org.springframework.data.util.ClassTypeInformation;
3230
import org.springframework.data.util.NullableWrapper;
3331
import org.springframework.data.util.NullableWrapperConverters;
3432
import org.springframework.data.util.TypeInformation;
@@ -66,15 +64,15 @@ class ProjectingMethodInterceptor implements MethodInterceptor {
6664
@Override
6765
public Object invoke(@SuppressWarnings("null") @NonNull MethodInvocation invocation) throws Throwable {
6866

69-
TypeInformation<?> type = ClassTypeInformation.fromReturnTypeOf(invocation.getMethod());
67+
TypeInformation<?> type = TypeInformation.fromReturnTypeOf(invocation.getMethod());
7068
TypeInformation<?> resultType = type;
7169
TypeInformation<?> typeToReturn = type;
7270

7371
Object result = delegate.invoke(invocation);
7472
boolean applyWrapper = false;
7573

7674
if (NullableWrapperConverters.supports(type.getType())
77-
&& (result == null || !NullableWrapperConverters.supports(result.getClass()))) {
75+
&& ((result == null) || !NullableWrapperConverters.supports(result.getClass()))) {
7876
resultType = NullableWrapperConverters.unwrapActualType(typeToReturn);
7977
applyWrapper = true;
8078
}
@@ -161,7 +159,7 @@ private Map<Object, Object> projectMapValues(Map<?, ?> sources, TypeInformation<
161159

162160
@Nullable
163161
private Object getProjection(@Nullable Object result, Class<?> returnType) {
164-
return result == null || ClassUtils.isAssignable(returnType, result.getClass()) ? result
162+
return (result == null) || ClassUtils.isAssignable(returnType, result.getClass()) ? result
165163
: factory.createProjection(returnType, result);
166164
}
167165

Diff for: src/main/java/org/springframework/data/querydsl/binding/QuerydslBindings.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import org.springframework.data.mapping.PropertyPath;
2727
import org.springframework.data.mapping.PropertyReferenceException;
28-
import org.springframework.data.util.ClassTypeInformation;
2928
import org.springframework.data.util.Optionals;
3029
import org.springframework.data.util.TypeInformation;
3130
import org.springframework.lang.Nullable;
@@ -175,7 +174,7 @@ boolean isPathAvailable(String path, Class<?> type) {
175174
Assert.notNull(path, "Path must not be null");
176175
Assert.notNull(type, "Type must not be null");
177176

178-
return isPathAvailable(path, ClassTypeInformation.from(type));
177+
return isPathAvailable(path, TypeInformation.of(type));
179178
}
180179

181180
/**
@@ -573,7 +572,7 @@ public Optional<MultiValueBinding<P, T>> getBinding() {
573572
}
574573

575574
@Override
576-
public boolean equals(Object o) {
575+
public boolean equals(@Nullable Object o) {
577576
if (this == o) {
578577
return true;
579578
}
@@ -589,7 +588,7 @@ public boolean equals(Object o) {
589588
@Override
590589
public int hashCode() {
591590
int result = ObjectUtils.nullSafeHashCode(path);
592-
result = 31 * result + ObjectUtils.nullSafeHashCode(binding);
591+
result = (31 * result) + ObjectUtils.nullSafeHashCode(binding);
593592
return result;
594593
}
595594

0 commit comments

Comments
 (0)