HHH-18704 optimize away equals() search for records + enums
This commit is contained in:
parent
72e0f2968a
commit
9166d73f36
|
@ -117,6 +117,9 @@ public final class ReflectHelper {
|
||||||
* @return True if clazz defines an equals override.
|
* @return True if clazz defines an equals override.
|
||||||
*/
|
*/
|
||||||
public static boolean overridesEquals(Class<?> clazz) {
|
public static boolean overridesEquals(Class<?> clazz) {
|
||||||
|
if ( clazz.isRecord() || clazz.isEnum() ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Method equals;
|
Method equals;
|
||||||
try {
|
try {
|
||||||
equals = extractEqualsMethod( clazz );
|
equals = extractEqualsMethod( clazz );
|
||||||
|
@ -134,6 +137,9 @@ public final class ReflectHelper {
|
||||||
* @return True if clazz defines an hashCode override.
|
* @return True if clazz defines an hashCode override.
|
||||||
*/
|
*/
|
||||||
public static boolean overridesHashCode(Class<?> clazz) {
|
public static boolean overridesHashCode(Class<?> clazz) {
|
||||||
|
if ( clazz.isRecord() || clazz.isEnum() ) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Method hashCode;
|
Method hashCode;
|
||||||
try {
|
try {
|
||||||
hashCode = extractHashCodeMethod( clazz );
|
hashCode = extractHashCodeMethod( clazz );
|
||||||
|
|
Loading…
Reference in New Issue