diff --git a/spring-test/src/main/java/org/springframework/test/context/cache/AotMergedContextConfiguration.java b/spring-test/src/main/java/org/springframework/test/context/cache/AotMergedContextConfiguration.java index 6a6d4e68137..101d7c34777 100644 --- a/spring-test/src/main/java/org/springframework/test/context/cache/AotMergedContextConfiguration.java +++ b/spring-test/src/main/java/org/springframework/test/context/cache/AotMergedContextConfiguration.java @@ -37,7 +37,7 @@ import org.springframework.test.context.MergedContextConfiguration; * @author Sam Brannen * @since 6.0 */ -class AotMergedContextConfiguration extends MergedContextConfiguration { +final class AotMergedContextConfiguration extends MergedContextConfiguration { private static final long serialVersionUID = 1963364911008547843L; @@ -71,33 +71,13 @@ class AotMergedContextConfiguration extends MergedContextConfiguration { if (this == other) { return true; } - if (other == null || other.getClass() != getClass()) { - return false; - } - AotMergedContextConfiguration that = (AotMergedContextConfiguration) other; - if (!this.contextInitializerClass.equals(that.contextInitializerClass)) { - return false; - } - if (!nullSafeClassName(getContextLoader()).equals(nullSafeClassName(that.getContextLoader()))) { - return false; - } - if (getParent() == null) { - if (that.getParent() != null) { - return false; - } - } - else if (!getParent().equals(that.getParent())) { - return false; - } - return true; + return ((other instanceof AotMergedContextConfiguration that) && + this.contextInitializerClass.equals(that.contextInitializerClass)); } @Override public int hashCode() { - int result = this.contextInitializerClass.hashCode(); - result = 31 * result + nullSafeClassName(getContextLoader()).hashCode(); - result = 31 * result + (getParent() != null ? getParent().hashCode() : 0); - return result; + return this.contextInitializerClass.hashCode(); } @Override