Skip to content

Commit c24ba26

Browse files
committed
Polishing.
Use Spring's nullability annotations where used as part of API nullability indicators. See #2385
1 parent e57238f commit c24ba26

File tree

39 files changed

+125
-149
lines changed

39 files changed

+125
-149
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<dependency>
8787
<groupId>com.google.code.findbugs</groupId>
8888
<artifactId>jsr305</artifactId>
89-
<version>2.0.1</version>
89+
<version>3.0.2</version>
9090
<optional>true</optional>
9191
</dependency>
9292

src/main/java/org/springframework/data/auditing/config/AuditingHandlerBeanDefinitionParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
import static org.springframework.beans.factory.support.BeanDefinitionBuilder.*;
1919

20-
import javax.annotation.Nonnull;
21-
2220
import org.springframework.aop.framework.ProxyFactoryBean;
2321
import org.springframework.aop.target.LazyInitTargetSource;
2422
import org.springframework.beans.factory.config.BeanDefinition;
@@ -30,8 +28,10 @@
3028
import org.springframework.data.auditing.AuditingHandler;
3129
import org.springframework.data.config.ParsingUtils;
3230
import org.springframework.data.mapping.context.MappingContext;
31+
import org.springframework.lang.NonNull;
3332
import org.springframework.util.Assert;
3433
import org.springframework.util.StringUtils;
34+
3535
import org.w3c.dom.Element;
3636

3737
/**
@@ -73,7 +73,7 @@ public String getResolvedBeanName() {
7373
* (non-Javadoc)
7474
* @see org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser#getBeanClass(org.w3c.dom.Element)
7575
*/
76-
@Nonnull
76+
@NonNull
7777
@Override
7878
protected Class<?> getBeanClass(Element element) {
7979
return AuditingHandler.class;

src/main/java/org/springframework/data/convert/ConfigurableTypeInformationMapper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@
1919
import java.util.Map;
2020
import java.util.Map.Entry;
2121

22-
import javax.annotation.Nullable;
23-
2422
import org.springframework.data.mapping.Alias;
2523
import org.springframework.data.mapping.PersistentEntity;
2624
import org.springframework.data.mapping.context.MappingContext;
2725
import org.springframework.data.util.ClassTypeInformation;
2826
import org.springframework.data.util.TypeInformation;
27+
import org.springframework.lang.Nullable;
2928
import org.springframework.util.Assert;
3029

3130
/**

src/main/java/org/springframework/data/convert/JodaTimeConverters.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
import java.util.Date;
2424
import java.util.List;
2525

26-
import javax.annotation.Nonnull;
27-
2826
import org.joda.time.DateTime;
2927
import org.joda.time.LocalDate;
3028
import org.joda.time.LocalDateTime;
29+
3130
import org.springframework.core.convert.converter.Converter;
31+
import org.springframework.lang.NonNull;
3232
import org.springframework.util.ClassUtils;
3333

3434
/**
@@ -82,7 +82,7 @@ public enum LocalDateTimeToJsr310Converter implements Converter<LocalDateTime, j
8282

8383
INSTANCE;
8484

85-
@Nonnull
85+
@NonNull
8686
@Override
8787
public java.time.LocalDateTime convert(LocalDateTime source) {
8888
return java.time.LocalDateTime.ofInstant(source.toDate().toInstant(), ZoneId.systemDefault());
@@ -94,7 +94,7 @@ public enum LocalDateToDateConverter implements Converter<LocalDate, Date> {
9494

9595
INSTANCE;
9696

97-
@Nonnull
97+
@NonNull
9898
@Override
9999
public Date convert(LocalDate source) {
100100
return source.toDate();
@@ -106,7 +106,7 @@ public enum LocalDateTimeToDateConverter implements Converter<LocalDateTime, Dat
106106

107107
INSTANCE;
108108

109-
@Nonnull
109+
@NonNull
110110
@Override
111111
public Date convert(LocalDateTime source) {
112112
return source.toDate();
@@ -118,7 +118,7 @@ public enum DateTimeToDateConverter implements Converter<DateTime, Date> {
118118

119119
INSTANCE;
120120

121-
@Nonnull
121+
@NonNull
122122
@Override
123123
public Date convert(DateTime source) {
124124
return source.toDate();
@@ -130,7 +130,7 @@ public enum DateToLocalDateConverter implements Converter<Date, LocalDate> {
130130

131131
INSTANCE;
132132

133-
@Nonnull
133+
@NonNull
134134
@Override
135135
public LocalDate convert(Date source) {
136136
return new LocalDate(source.getTime());
@@ -142,7 +142,7 @@ public enum DateToLocalDateTimeConverter implements Converter<Date, LocalDateTim
142142

143143
INSTANCE;
144144

145-
@Nonnull
145+
@NonNull
146146
@Override
147147
public LocalDateTime convert(Date source) {
148148
return new LocalDateTime(source.getTime());
@@ -154,7 +154,7 @@ public enum DateToDateTimeConverter implements Converter<Date, DateTime> {
154154

155155
INSTANCE;
156156

157-
@Nonnull
157+
@NonNull
158158
@Override
159159
public DateTime convert(Date source) {
160160
return new DateTime(source.getTime());
@@ -167,7 +167,7 @@ public enum LocalDateTimeToJodaLocalDateTime implements Converter<java.time.Loca
167167

168168
INSTANCE;
169169

170-
@Nonnull
170+
@NonNull
171171
@Override
172172
public LocalDateTime convert(java.time.LocalDateTime source) {
173173
return LocalDateTime.fromDateFields(Jsr310Converters.LocalDateTimeToDateConverter.INSTANCE.convert(source));
@@ -179,7 +179,7 @@ public enum InstantToJodaLocalDateTime implements Converter<java.time.Instant, L
179179

180180
INSTANCE;
181181

182-
@Nonnull
182+
@NonNull
183183
@Override
184184
public LocalDateTime convert(java.time.Instant source) {
185185
return LocalDateTime.fromDateFields(new Date(source.toEpochMilli()));
@@ -191,7 +191,7 @@ public enum JodaLocalDateTimeToInstant implements Converter<LocalDateTime, Insta
191191

192192
INSTANCE;
193193

194-
@Nonnull
194+
@NonNull
195195
@Override
196196
public Instant convert(LocalDateTime source) {
197197
return Instant.ofEpochMilli(source.toDateTime().getMillis());
@@ -203,7 +203,7 @@ public enum LocalDateTimeToJodaDateTime implements Converter<java.time.LocalDate
203203

204204
INSTANCE;
205205

206-
@Nonnull
206+
@NonNull
207207
@Override
208208
public DateTime convert(java.time.LocalDateTime source) {
209209
return new DateTime(Jsr310Converters.LocalDateTimeToDateConverter.INSTANCE.convert(source));

src/main/java/org/springframework/data/convert/Jsr310Converters.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
import java.util.Date;
3434
import java.util.List;
3535

36-
import javax.annotation.Nonnull;
37-
3836
import org.springframework.core.convert.converter.Converter;
3937
import org.springframework.lang.NonNull;
4038

@@ -93,7 +91,7 @@ public static enum DateToLocalDateTimeConverter implements Converter<Date, Local
9391

9492
INSTANCE;
9593

96-
@Nonnull
94+
@NonNull
9795
@Override
9896
public LocalDateTime convert(Date source) {
9997
return ofInstant(source.toInstant(), systemDefault());
@@ -105,7 +103,7 @@ public static enum LocalDateTimeToDateConverter implements Converter<LocalDateTi
105103

106104
INSTANCE;
107105

108-
@Nonnull
106+
@NonNull
109107
@Override
110108
public Date convert(LocalDateTime source) {
111109
return Date.from(source.atZone(systemDefault()).toInstant());
@@ -117,7 +115,7 @@ public static enum DateToLocalDateConverter implements Converter<Date, LocalDate
117115

118116
INSTANCE;
119117

120-
@Nonnull
118+
@NonNull
121119
@Override
122120
public LocalDate convert(Date source) {
123121
return ofInstant(ofEpochMilli(source.getTime()), systemDefault()).toLocalDate();
@@ -129,7 +127,7 @@ public static enum LocalDateToDateConverter implements Converter<LocalDate, Date
129127

130128
INSTANCE;
131129

132-
@Nonnull
130+
@NonNull
133131
@Override
134132
public Date convert(LocalDate source) {
135133
return Date.from(source.atStartOfDay(systemDefault()).toInstant());
@@ -141,7 +139,7 @@ public static enum DateToLocalTimeConverter implements Converter<Date, LocalTime
141139

142140
INSTANCE;
143141

144-
@Nonnull
142+
@NonNull
145143
@Override
146144
public LocalTime convert(Date source) {
147145
return ofInstant(ofEpochMilli(source.getTime()), systemDefault()).toLocalTime();
@@ -153,7 +151,7 @@ public static enum LocalTimeToDateConverter implements Converter<LocalTime, Date
153151

154152
INSTANCE;
155153

156-
@Nonnull
154+
@NonNull
157155
@Override
158156
public Date convert(LocalTime source) {
159157
return Date.from(source.atDate(LocalDate.now()).atZone(systemDefault()).toInstant());
@@ -165,7 +163,7 @@ public static enum DateToInstantConverter implements Converter<Date, Instant> {
165163

166164
INSTANCE;
167165

168-
@Nonnull
166+
@NonNull
169167
@Override
170168
public Instant convert(Date source) {
171169
return source.toInstant();
@@ -177,7 +175,7 @@ public static enum InstantToDateConverter implements Converter<Instant, Date> {
177175

178176
INSTANCE;
179177

180-
@Nonnull
178+
@NonNull
181179
@Override
182180
public Date convert(Instant source) {
183181
return Date.from(source);
@@ -189,7 +187,7 @@ public static enum LocalDateTimeToInstantConverter implements Converter<LocalDat
189187

190188
INSTANCE;
191189

192-
@Nonnull
190+
@NonNull
193191
@Override
194192
public Instant convert(LocalDateTime source) {
195193
return source.atZone(systemDefault()).toInstant();
@@ -201,7 +199,7 @@ public static enum InstantToLocalDateTimeConverter implements Converter<Instant,
201199

202200
INSTANCE;
203201

204-
@Nonnull
202+
@NonNull
205203
@Override
206204
public LocalDateTime convert(Instant source) {
207205
return LocalDateTime.ofInstant(source, systemDefault());
@@ -213,7 +211,7 @@ public static enum ZoneIdToStringConverter implements Converter<ZoneId, String>
213211

214212
INSTANCE;
215213

216-
@Nonnull
214+
@NonNull
217215
@Override
218216
public String convert(ZoneId source) {
219217
return source.toString();
@@ -225,7 +223,7 @@ public static enum StringToZoneIdConverter implements Converter<String, ZoneId>
225223

226224
INSTANCE;
227225

228-
@Nonnull
226+
@NonNull
229227
@Override
230228
public ZoneId convert(String source) {
231229
return ZoneId.of(source);
@@ -237,7 +235,7 @@ public static enum DurationToStringConverter implements Converter<Duration, Stri
237235

238236
INSTANCE;
239237

240-
@Nonnull
238+
@NonNull
241239
@Override
242240
public String convert(Duration duration) {
243241
return duration.toString();
@@ -249,7 +247,7 @@ public static enum StringToDurationConverter implements Converter<String, Durati
249247

250248
INSTANCE;
251249

252-
@Nonnull
250+
@NonNull
253251
@Override
254252
public Duration convert(String s) {
255253
return Duration.parse(s);
@@ -261,7 +259,7 @@ public static enum PeriodToStringConverter implements Converter<Period, String>
261259

262260
INSTANCE;
263261

264-
@Nonnull
262+
@NonNull
265263
@Override
266264
public String convert(Period period) {
267265
return period.toString();
@@ -273,7 +271,7 @@ public static enum StringToPeriodConverter implements Converter<String, Period>
273271

274272
INSTANCE;
275273

276-
@Nonnull
274+
@NonNull
277275
@Override
278276
public Period convert(String s) {
279277
return Period.parse(s);

0 commit comments

Comments
 (0)