Browse Source

Polishing

pull/31598/head
Juergen Hoeller 1 year ago
parent
commit
24893d038f
  1. 10
      spring-context/src/main/java/org/springframework/context/annotation/BeanMethod.java
  2. 6
      spring-core/src/main/java/org/springframework/core/ParameterizedTypeReference.java
  3. 16
      spring-core/src/main/java/org/springframework/core/env/ProfilesParser.java
  4. 14
      spring-core/src/main/java/org/springframework/core/type/classreading/SimpleAnnotationMetadataReadingVisitor.java
  5. 3
      spring-orm/src/main/java/org/springframework/orm/hibernate5/SpringFlushSynchronization.java
  6. 16
      spring-test/src/main/java/org/springframework/test/context/support/DynamicPropertiesContextCustomizer.java

10
spring-context/src/main/java/org/springframework/context/annotation/BeanMethod.java

@ -1,5 +1,5 @@ @@ -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.
@ -39,6 +39,7 @@ final class BeanMethod extends ConfigurationMethod { @@ -39,6 +39,7 @@ final class BeanMethod extends ConfigurationMethod {
super(metadata, configurationClass);
}
@Override
public void validate(ProblemReporter problemReporter) {
if (getMetadata().isStatic()) {
@ -55,9 +56,9 @@ final class BeanMethod extends ConfigurationMethod { @@ -55,9 +56,9 @@ final class BeanMethod extends ConfigurationMethod {
}
@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
@ -70,6 +71,7 @@ final class BeanMethod extends ConfigurationMethod { @@ -70,6 +71,7 @@ final class BeanMethod extends ConfigurationMethod {
return "BeanMethod: " + this.metadata;
}
private class NonOverridableMethodError extends Problem {
NonOverridableMethodError() {

6
spring-core/src/main/java/org/springframework/core/ParameterizedTypeReference.java

@ -1,5 +1,5 @@ @@ -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.
@ -14,7 +14,6 @@ @@ -14,7 +14,6 @@
* limitations under the License.
*/
package org.springframework.core;
import java.lang.reflect.ParameterizedType;
@ -92,8 +91,7 @@ public abstract class ParameterizedTypeReference<T> { @@ -92,8 +91,7 @@ public abstract class ParameterizedTypeReference<T> {
* @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) {

16
spring-core/src/main/java/org/springframework/core/env/ProfilesParser.java vendored

@ -168,31 +168,27 @@ final class ProfilesParser { @@ -168,31 +168,27 @@ final class ProfilesParser {
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 ");
}
}
}

14
spring-core/src/main/java/org/springframework/core/type/classreading/SimpleAnnotationMetadataReadingVisitor.java

@ -1,5 +1,5 @@ @@ -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.
@ -171,6 +171,7 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor { @@ -171,6 +171,7 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor {
return (access & Opcodes.ACC_INTERFACE) != 0;
}
/**
* {@link MergedAnnotation} source.
*/
@ -182,11 +183,6 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor { @@ -182,11 +183,6 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor {
this.className = className;
}
@Override
public int hashCode() {
return this.className.hashCode();
}
@Override
public boolean equals(@Nullable Object obj) {
if (this == obj) {
@ -198,11 +194,15 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor { @@ -198,11 +194,15 @@ final class SimpleAnnotationMetadataReadingVisitor extends ClassVisitor {
return this.className.equals(((Source) obj).className);
}
@Override
public int hashCode() {
return this.className.hashCode();
}
@Override
public String toString() {
return this.className;
}
}
}

3
spring-orm/src/main/java/org/springframework/orm/hibernate5/SpringFlushSynchronization.java

@ -1,5 +1,5 @@ @@ -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.
@ -43,7 +43,6 @@ public class SpringFlushSynchronization implements TransactionSynchronization { @@ -43,7 +43,6 @@ public class SpringFlushSynchronization implements TransactionSynchronization {
SessionFactoryUtils.flush(this.session, false);
}
@Override
public boolean equals(@Nullable Object other) {
return (this == other || (other instanceof SpringFlushSynchronization &&

16
spring-test/src/main/java/org/springframework/test/context/support/DynamicPropertiesContextCustomizer.java

@ -1,5 +1,5 @@ @@ -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.
@ -46,7 +46,6 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer { @@ -46,7 +46,6 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
private static final String PROPERTY_SOURCE_NAME = "Dynamic Test Properties";
private final Set<Method> methods;
@ -65,9 +64,7 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer { @@ -65,9 +64,7 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
}
@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()));
}
@ -90,10 +87,6 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer { @@ -90,10 +87,6 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
return this.methods;
}
@Override
public int hashCode() {
return this.methods.hashCode();
}
@Override
public boolean equals(Object obj) {
@ -106,4 +99,9 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer { @@ -106,4 +99,9 @@ class DynamicPropertiesContextCustomizer implements ContextCustomizer {
return this.methods.equals(((DynamicPropertiesContextCustomizer) obj).methods);
}
@Override
public int hashCode() {
return this.methods.hashCode();
}
}

Loading…
Cancel
Save