mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Merge pull request #50866 from quaff
Closes gh-50866 * gh-50866: Polish "Remove unnecessary `@Nullable`s from local variable declarations" Remove unnecessary `@Nullable`s from local variable declarations
This commit is contained in:
@@ -82,7 +82,7 @@ public class BasicJsonParser extends AbstractJsonParser {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
json = trimEdges(json, '{', '}').trim();
|
||||
for (String pair : tokenize(json)) {
|
||||
String @Nullable [] split = StringUtils.split(pair, ":");
|
||||
String[] split = StringUtils.split(pair, ":");
|
||||
Assert.state(split != null, () -> "Unable to parse '%s'".formatted(pair));
|
||||
@Nullable String[] rawElement = StringUtils.trimArrayElements(split);
|
||||
String rawKey = rawElement[0];
|
||||
|
||||
+2
-3
@@ -19,7 +19,6 @@ package org.springframework.boot.jackson.autoconfigure.jsontest.app;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import tools.jackson.core.JsonGenerator;
|
||||
import tools.jackson.core.JsonParser;
|
||||
import tools.jackson.databind.DeserializationContext;
|
||||
@@ -45,11 +44,11 @@ public class ExampleJacksonComponent {
|
||||
@Override
|
||||
protected void serializeObject(ExampleCustomObject value, JsonGenerator jgen, SerializationContext context) {
|
||||
jgen.writeStringProperty("value", value.value());
|
||||
@Nullable Date date = value.date();
|
||||
Date date = value.date();
|
||||
if (date != null) {
|
||||
jgen.writeNumberProperty("date", date.getTime());
|
||||
}
|
||||
@Nullable UUID uuid = value.uuid();
|
||||
UUID uuid = value.uuid();
|
||||
if (uuid != null) {
|
||||
jgen.writeStringProperty("uuid", uuid.toString());
|
||||
}
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ public class PropertiesMeterFilter implements MeterFilter {
|
||||
if (values.isEmpty()) {
|
||||
return defaultValue;
|
||||
}
|
||||
@Nullable T result = doLookup(values, id);
|
||||
T result = doLookup(values, id);
|
||||
return (result != null) ? result : values.getOrDefault("all", defaultValue);
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ package smoketest.integration.producer;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import smoketest.integration.ServiceProperties;
|
||||
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
@@ -41,7 +40,7 @@ public class ProducerApplication implements ApplicationRunner {
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
@Nullable File inputDir = this.serviceProperties.getInputDir();
|
||||
File inputDir = this.serviceProperties.getInputDir();
|
||||
Assert.notNull(inputDir, "No inputDir configured");
|
||||
inputDir.mkdirs();
|
||||
if (!args.getNonOptionArgs().isEmpty()) {
|
||||
|
||||
+1
-2
@@ -19,7 +19,6 @@ package smoketest.parent.producer;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import smoketest.parent.ServiceProperties;
|
||||
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
@@ -41,7 +40,7 @@ public class ProducerApplication implements ApplicationRunner {
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) throws Exception {
|
||||
@Nullable File inputDir = this.serviceProperties.getInputDir();
|
||||
File inputDir = this.serviceProperties.getInputDir();
|
||||
Assert.notNull(inputDir, "No inputDir configured");
|
||||
inputDir.mkdirs();
|
||||
if (!args.getNonOptionArgs().isEmpty()) {
|
||||
|
||||
Reference in New Issue
Block a user