Merge branch '6.0.x'
This commit is contained in:
@@ -61,6 +61,7 @@ public final class ClassFiles implements Iterable<ClassFile> {
|
||||
return none().and(ClassFiles);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a new {@link ClassFiles} instance that merges classes from
|
||||
* another array of {@link ClassFile} instances.
|
||||
@@ -116,15 +117,10 @@ public final class ClassFiles implements Iterable<ClassFile> {
|
||||
return this.files.get(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return this.files.equals(((ClassFiles) obj).files);
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof ClassFiles that && this.files.equals(that.files)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.core.test.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -81,22 +80,16 @@ public abstract sealed class DynamicFile permits SourceFile, ResourceFile {
|
||||
return this.path;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
DynamicFile other = (DynamicFile) obj;
|
||||
return Objects.equals(this.path, other.path)
|
||||
&& Objects.equals(this.content, other.content);
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof DynamicFile that &&
|
||||
this.path.equals(that.path) && this.content.equals(that.content)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.path, this.content);
|
||||
return this.path.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,6 @@ final class DynamicFiles<F extends DynamicFile> implements Iterable<F> {
|
||||
|
||||
private static final DynamicFiles<?> NONE = new DynamicFiles<>(Collections.emptyMap());
|
||||
|
||||
|
||||
private final Map<String, F> files;
|
||||
|
||||
|
||||
@@ -101,15 +100,10 @@ final class DynamicFiles<F extends DynamicFile> implements Iterable<F> {
|
||||
return files.iterator().next();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return this.files.equals(((DynamicFiles<?>) obj).files);
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof DynamicFiles<?> that && this.files.equals(that.files)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -130,15 +130,10 @@ public final class ResourceFiles implements Iterable<ResourceFile> {
|
||||
return this.files.getSingle();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return this.files.equals(((ResourceFiles) obj).files);
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof ResourceFiles that && this.files.equals(that.files)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.core.test.tools;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Objects;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -155,19 +154,14 @@ public final class SourceFiles implements Iterable<SourceFile> {
|
||||
* one file
|
||||
*/
|
||||
public SourceFile getSingleFromPackage(String packageName) {
|
||||
return this.files.getSingle(candidate -> Objects.equals(packageName,
|
||||
ClassUtils.getPackageName(candidate.getClassName())));
|
||||
return this.files.getSingle(candidate ->
|
||||
ClassUtils.getPackageName(candidate.getClassName()).equals(packageName));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null || getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
return this.files.equals(((SourceFiles) obj).files);
|
||||
public boolean equals(@Nullable Object other) {
|
||||
return (this == other || (other instanceof SourceFiles that && this.files.equals(that.files)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user