Consider generics in equals method (for ConversionService caching)

Closes gh-31672

(cherry picked from commit 710373d286)
This commit is contained in:
Juergen Hoeller
2023-11-24 23:25:59 +01:00
parent 5105fdf8c0
commit 0ecbeef01d
2 changed files with 52 additions and 39 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -476,7 +476,7 @@ public class TypeDescriptor implements Serializable {
ObjectUtils.nullSafeEquals(getMapValueTypeDescriptor(), otherDesc.getMapValueTypeDescriptor()));
}
else {
return true;
return Arrays.equals(getResolvableType().getGenerics(), otherDesc.getResolvableType().getGenerics());
}
}
@@ -523,7 +523,7 @@ public class TypeDescriptor implements Serializable {
/**
* Create a new type descriptor for an object.
* <p>Use this factory method to introspect a source object before asking the
* conversion system to convert it to some another type.
* conversion system to convert it to some other type.
* <p>If the provided object is {@code null}, returns {@code null}, else calls
* {@link #valueOf(Class)} to build a TypeDescriptor from the object's class.
* @param source the source object