Skip to content

Commit 88fd84a

Browse files
committed
Merge pull request spring-projects#15876 from wonwoo
* spring-projectsgh-15876: Polish "Remove unwanted @nullable annotations" Remove unwanted @nullable annotations Closes spring-projectsgh-15876
2 parents 6fe9e3a + 3f32fbd commit 88fd84a

File tree

7 files changed

+13
-27
lines changed

7 files changed

+13
-27
lines changed

spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfiguration.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,6 @@
4242
import org.springframework.context.event.ContextRefreshedEvent;
4343
import org.springframework.context.event.GenericApplicationListener;
4444
import org.springframework.core.ResolvableType;
45-
import org.springframework.lang.Nullable;
4645
import org.springframework.util.StringUtils;
4746

4847
/**
@@ -185,7 +184,7 @@ public boolean supportsEventType(ResolvableType eventType) {
185184
}
186185

187186
@Override
188-
public boolean supportsSourceType(@Nullable Class<?> sourceType) {
187+
public boolean supportsSourceType(Class<?> sourceType) {
189188
return true;
190189
}
191190

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/ExampleIdConverter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
2424
import org.springframework.core.convert.TypeDescriptor;
2525
import org.springframework.core.convert.converter.GenericConverter;
26-
import org.springframework.lang.Nullable;
2726
import org.springframework.stereotype.Component;
2827

2928
/**
@@ -39,9 +38,8 @@ public Set<ConvertiblePair> getConvertibleTypes() {
3938
return Collections.singleton(new ConvertiblePair(String.class, ExampleId.class));
4039
}
4140

42-
@Nullable
4341
@Override
44-
public Object convert(@Nullable Object source, TypeDescriptor sourceType,
42+
public Object convert(Object source, TypeDescriptor sourceType,
4543
TypeDescriptor targetType) {
4644
if (source == null) {
4745
return null;

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/admin/SpringApplicationAdminMXBeanRegistrar.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,7 +40,6 @@
4040
import org.springframework.core.ResolvableType;
4141
import org.springframework.core.env.Environment;
4242
import org.springframework.core.env.StandardEnvironment;
43-
import org.springframework.lang.Nullable;
4443
import org.springframework.util.Assert;
4544

4645
/**
@@ -95,7 +94,7 @@ public boolean supportsEventType(ResolvableType eventType) {
9594
}
9695

9796
@Override
98-
public boolean supportsSourceType(@Nullable Class<?> sourceType) {
97+
public boolean supportsSourceType(Class<?> sourceType) {
9998
return true;
10099
}
101100

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/ArrayToDelimitedStringConverter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@
2424
import org.springframework.core.convert.ConversionService;
2525
import org.springframework.core.convert.TypeDescriptor;
2626
import org.springframework.core.convert.converter.ConditionalGenericConverter;
27-
import org.springframework.lang.Nullable;
2827
import org.springframework.util.ObjectUtils;
2928

3029
/**
@@ -51,8 +50,7 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
5150
}
5251

5352
@Override
54-
@Nullable
55-
public Object convert(@Nullable Object source, TypeDescriptor sourceType,
53+
public Object convert(Object source, TypeDescriptor sourceType,
5654
TypeDescriptor targetType) {
5755
List<Object> list = Arrays.asList(ObjectUtils.toObjectArray(source));
5856
return this.delegate.convert(list, sourceType, targetType);

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToArrayConverter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,6 @@
2323
import org.springframework.core.convert.ConversionService;
2424
import org.springframework.core.convert.TypeDescriptor;
2525
import org.springframework.core.convert.converter.ConditionalGenericConverter;
26-
import org.springframework.lang.Nullable;
2726
import org.springframework.util.Assert;
2827
import org.springframework.util.StringUtils;
2928

@@ -53,8 +52,7 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
5352
}
5453

5554
@Override
56-
@Nullable
57-
public Object convert(@Nullable Object source, TypeDescriptor sourceType,
55+
public Object convert(Object source, TypeDescriptor sourceType,
5856
TypeDescriptor targetType) {
5957
if (source == null) {
6058
return null;

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/DelimitedStringToCollectionConverter.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2018 the original author or authors.
2+
* Copyright 2012-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@
2626
import org.springframework.core.convert.ConversionService;
2727
import org.springframework.core.convert.TypeDescriptor;
2828
import org.springframework.core.convert.converter.ConditionalGenericConverter;
29-
import org.springframework.lang.Nullable;
3029
import org.springframework.util.Assert;
3130
import org.springframework.util.StringUtils;
3231

@@ -56,8 +55,7 @@ public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
5655
}
5756

5857
@Override
59-
@Nullable
60-
public Object convert(@Nullable Object source, TypeDescriptor sourceType,
58+
public Object convert(Object source, TypeDescriptor sourceType,
6159
TypeDescriptor targetType) {
6260
if (source == null) {
6361
return null;

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/ConfigurationPropertiesTests.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
import org.springframework.core.io.ProtocolResolver;
6767
import org.springframework.core.io.Resource;
6868
import org.springframework.core.io.ResourceLoader;
69-
import org.springframework.lang.Nullable;
7069
import org.springframework.mock.env.MockEnvironment;
7170
import org.springframework.stereotype.Component;
7271
import org.springframework.test.context.support.TestPropertySourceUtils;
@@ -1785,7 +1784,6 @@ public void validate(Object target, Errors errors) {
17851784

17861785
static class PersonConverter implements Converter<String, Person> {
17871786

1788-
@Nullable
17891787
@Override
17901788
public Person convert(String source) {
17911789
String[] content = StringUtils.split(source, " ");
@@ -1796,15 +1794,13 @@ public Person convert(String source) {
17961794

17971795
static class GenericPersonConverter implements GenericConverter {
17981796

1799-
@Nullable
18001797
@Override
18011798
public Set<ConvertiblePair> getConvertibleTypes() {
18021799
return Collections.singleton(new ConvertiblePair(String.class, Person.class));
18031800
}
18041801

1805-
@Nullable
18061802
@Override
1807-
public Object convert(@Nullable Object source, TypeDescriptor sourceType,
1803+
public Object convert(Object source, TypeDescriptor sourceType,
18081804
TypeDescriptor targetType) {
18091805
String[] content = StringUtils.split((String) source, " ");
18101806
return new Person(content[0], content[1]);

0 commit comments

Comments
 (0)