Skip to content

Commit b0b4b47

Browse files
committed
Explicit nullability declarations for getTarget() implementations
1 parent c9573a4 commit b0b4b47

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

spring-context/src/main/java/org/springframework/validation/BindException.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -58,7 +58,7 @@ public BindException(BindingResult bindingResult) {
5858

5959
/**
6060
* Create a new BindException instance for a target bean.
61-
* @param target target bean to bind onto
61+
* @param target the target bean to bind onto
6262
* @param objectName the name of the target object
6363
* @see BeanPropertyBindingResult
6464
*/
@@ -70,8 +70,6 @@ public BindException(Object target, String objectName) {
7070

7171
/**
7272
* Return the BindingResult that this BindException wraps.
73-
* Will typically be a BeanPropertyBindingResult.
74-
* @see BeanPropertyBindingResult
7573
*/
7674
public final BindingResult getBindingResult() {
7775
return this.bindingResult;
@@ -231,6 +229,7 @@ public Class<?> getFieldType(String field) {
231229
}
232230

233231
@Override
232+
@Nullable
234233
public Object getTarget() {
235234
return this.bindingResult.getTarget();
236235
}

spring-context/src/main/java/org/springframework/validation/MapBindingResult.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2006 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -19,6 +19,7 @@
1919
import java.io.Serializable;
2020
import java.util.Map;
2121

22+
import org.springframework.lang.NonNull;
2223
import org.springframework.lang.Nullable;
2324
import org.springframework.util.Assert;
2425

@@ -52,11 +53,15 @@ public MapBindingResult(Map<?, ?> target, String objectName) {
5253
}
5354

5455

56+
/**
57+
* Return the target Map to bind onto.
58+
*/
5559
public final Map<?, ?> getTargetMap() {
5660
return this.target;
5761
}
5862

5963
@Override
64+
@NonNull
6065
public final Object getTarget() {
6166
return this.target;
6267
}

spring-web/src/main/java/org/springframework/web/bind/support/WebExchangeBindException.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -217,6 +217,7 @@ public Class<?> getFieldType(String field) {
217217
}
218218

219219
@Override
220+
@Nullable
220221
public Object getTarget() {
221222
return this.bindingResult.getTarget();
222223
}

0 commit comments

Comments
 (0)