Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Aug 4, 2023
1 parent b948237 commit 24893d0
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
Expand Down Expand Up @@ -39,6 +39,7 @@ final class BeanMethod extends ConfigurationMethod {
super(metadata, configurationClass);
}


@Override
public void validate(ProblemReporter problemReporter) {
if (getMetadata().isStatic()) {
Expand All @@ -55,9 +56,9 @@ public void validate(ProblemReporter problemReporter) {
}

@Override
public boolean equals(@Nullable Object obj) {
return ((this == obj) || ((obj instanceof BeanMethod) &&
this.metadata.equals(((BeanMethod) obj).metadata)));
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof BeanMethod &&
this.metadata.equals(((BeanMethod) other).metadata)));
}

@Override
Expand All @@ -70,6 +71,7 @@ public String toString() {
return "BeanMethod: " + this.metadata;
}


private class NonOverridableMethodError extends Problem {

NonOverridableMethodError() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2018 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.
Expand All @@ -14,7 +14,6 @@
* limitations under the License.
*/


package org.springframework.core;

import java.lang.reflect.ParameterizedType;
Expand Down Expand Up @@ -92,8 +91,7 @@ public String toString() {
* @since 4.3.12
*/
public static <T> ParameterizedTypeReference<T> forType(Type type) {
return new ParameterizedTypeReference<T>(type) {
};
return new ParameterizedTypeReference<T>(type) {};
}

private static Class<?> findParameterizedTypeReferenceSubclass(Class<?> child) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,31 +168,27 @@ public boolean matches(Predicate<String> activeProfiles) {
return false;
}

@Override
public int hashCode() {
return this.expressions.hashCode();
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ParsedProfiles that = (ParsedProfiles) obj;
return this.expressions.equals(that.expressions);
}

@Override
public int hashCode() {
return this.expressions.hashCode();
}

@Override
public String toString() {
return StringUtils.collectionToDelimitedString(this.expressions, " or ");
}

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 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.
Expand Down Expand Up @@ -171,6 +171,7 @@ private boolean isInterface(int access) {
return (access & Opcodes.ACC_INTERFACE) != 0;
}


/**
* {@link MergedAnnotation} source.
*/
Expand All @@ -182,11 +183,6 @@ private static final class Source {
this.className = className;
}

@Override
public int hashCode() {
return this.className.hashCode();
}

@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
Expand All @@ -198,11 +194,15 @@ public boolean equals(@Nullable Object obj) {
return this.className.equals(((Source) obj).className);
}

@Override
public int hashCode() {
return this.className.hashCode();
}

@Override
public String toString() {
return this.className;
}

}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
Expand Down Expand Up @@ -43,7 +43,6 @@ public void flush() {
SessionFactoryUtils.flush(this.session, false);
}


@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof SpringFlushSynchronization &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 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.
Expand Down Expand Up @@ -46,7 +46,6 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {

private static final String PROPERTY_SOURCE_NAME = "Dynamic Test Properties";


private final Set<Method> methods;


Expand All @@ -65,9 +64,7 @@ private void assertValid(Method method) {
}

@Override
public void customizeContext(ConfigurableApplicationContext context,
MergedContextConfiguration mergedConfig) {

public void customizeContext(ConfigurableApplicationContext context, MergedContextConfiguration mergedConfig) {
MutablePropertySources sources = context.getEnvironment().getPropertySources();
sources.addFirst(new DynamicValuesPropertySource(PROPERTY_SOURCE_NAME, buildDynamicPropertiesMap()));
}
Expand All @@ -90,10 +87,6 @@ Set<Method> getMethods() {
return this.methods;
}

@Override
public int hashCode() {
return this.methods.hashCode();
}

@Override
public boolean equals(Object obj) {
Expand All @@ -106,4 +99,9 @@ public boolean equals(Object obj) {
return this.methods.equals(((DynamicPropertiesContextCustomizer) obj).methods);
}

@Override
public int hashCode() {
return this.methods.hashCode();
}

}

0 comments on commit 24893d0

Please sign in to comment.