Browse Source

Use Objects.equals() for null-safe string comparison

See gh-31305
pull/31306/head
ali dandach 1 year ago committed by Stéphane Nicoll
parent
commit
1d12c74042
  1. 1
      buildSrc/src/main/java/org/springframework/build/JavaConventions.java
  2. 1
      buildSrc/src/main/java/org/springframework/build/optional/OptionalDependenciesPlugin.java
  3. 5
      spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java

1
buildSrc/src/main/java/org/springframework/build/JavaConventions.java

@ -27,7 +27,6 @@ import org.gradle.api.plugins.JavaPlugin; @@ -27,7 +27,6 @@ import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.jvm.toolchain.JavaLanguageVersion;
import org.gradle.jvm.toolchain.JavaToolchainSpec;
import org.gradle.jvm.toolchain.JvmVendorSpec;
/**

1
buildSrc/src/main/java/org/springframework/build/optional/OptionalDependenciesPlugin.java

@ -20,7 +20,6 @@ import org.gradle.api.Plugin; @@ -20,7 +20,6 @@ import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.plugins.JavaBasePlugin;
import org.gradle.api.plugins.JavaPlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.SourceSetContainer;

5
spring-test/src/main/java/org/springframework/test/context/junit/jupiter/SpringExtension.java

@ -24,6 +24,7 @@ import java.lang.reflect.Modifier; @@ -24,6 +24,7 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.Parameter;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
@ -179,7 +180,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes @@ -179,7 +180,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes
testClass.getName(), Arrays.toString(methodsWithErrors)));
}, String.class);
if (errorMessage != NO_VIOLATIONS_DETECTED) {
if (!Objects.equals(errorMessage, NO_VIOLATIONS_DETECTED)) {
throw new IllegalStateException(errorMessage);
}
}
@ -218,7 +219,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes @@ -218,7 +219,7 @@ public class SpringExtension implements BeforeAllCallback, AfterAllCallback, Tes
published by other tests since the application context may be shared.""";
}, String.class);
if (errorMessage != NO_VIOLATIONS_DETECTED) {
if (!Objects.equals(errorMessage, NO_VIOLATIONS_DETECTED)) {
throw new IllegalStateException(errorMessage);
}
}

Loading…
Cancel
Save