Deprecate setDisallowedFields in DataBinder

Closes gh-36816
Signed-off-by: Juhwan Lee <jhan0121@gmail.com>
This commit is contained in:
jhan0121
2026-07-29 16:17:09 +03:00
committed by rstoyanchev
parent 3f632382d6
commit 4bcae5305d
6 changed files with 29 additions and 3 deletions
@@ -511,7 +511,6 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* account.
* <p>More sophisticated matching can be implemented by overriding the
* {@link #isAllowed} method.
* <p>Alternatively, specify a list of <i>disallowed</i> field patterns.
* <p>Used for binding to fields with {@link #bind(PropertyValues)}, and not
* applicable to constructor binding via {@link #construct},
* which uses only the values it needs.
@@ -554,7 +553,9 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* @param disallowedFields array of disallowed field patterns
* @see #setAllowedFields
* @see #isAllowed(String)
* @deprecated as of 7.1, in favor of {@link #setAllowedFields}.
*/
@Deprecated(since = "7.1", forRemoval = true)
public void setDisallowedFields(String @Nullable ... disallowedFields) {
if (disallowedFields == null) {
this.disallowedFields = null;
@@ -572,7 +573,9 @@ public class DataBinder implements PropertyEditorRegistry, TypeConverter {
* Return the field patterns that should <i>not</i> be allowed for binding.
* @return array of disallowed field patterns
* @see #setDisallowedFields(String...)
* @deprecated as of 7.1, in favor of {@link #getAllowedFields()}.
*/
@Deprecated(since = "7.1", forRemoval = true)
public String @Nullable [] getDisallowedFields() {
return this.disallowedFields;
}
@@ -715,6 +715,7 @@ class DataBinderTests {
}
@Test
@SuppressWarnings("removal")
void bindingWithDisallowedFields() throws BindException {
TestBean rod = new TestBean();
DataBinder binder = new DataBinder(rod);
@@ -734,6 +735,7 @@ class DataBinderTests {
}
@Test
@SuppressWarnings("removal")
void bindingWithAllowedAndDisallowedFields() throws BindException {
TestBean rod = new TestBean();
DataBinder binder = new DataBinder(rod);
@@ -752,6 +754,7 @@ class DataBinderTests {
}
@Test
@SuppressWarnings("removal")
void bindingWithOverlappingAllowedAndDisallowedFields() throws BindException {
TestBean rod = new TestBean();
DataBinder binder = new DataBinder(rod);
@@ -797,6 +800,7 @@ class DataBinderTests {
}
@Test
@SuppressWarnings("removal")
void bindingWithAllowedAndDisallowedMapFields() throws BindException {
TestBean rod = new TestBean();
DataBinder binder = new DataBinder(rod);