Skip to content

Commit b4619f3

Browse files
BELHAKEL Ammarjzheaux
BELHAKEL Ammar
authored andcommitted
Fix return type
AbstractConfiguredSecurityBuilder.objectPostProcessor() should cast to B, the type of SecurityBuilder, instead of O, the type of object being built. Without this change, calls like http.objectPostProcessor(...).getFilters() will fail with a ClassCastException.
1 parent f109388 commit b4619f3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,10 @@ public <C extends SecurityConfigurer<O, B>> C removeConfigurer(Class<C> clazz) {
286286
* @return the {@link SecurityBuilder} for further customizations
287287
*/
288288
@SuppressWarnings("unchecked")
289-
public O objectPostProcessor(ObjectPostProcessor<Object> objectPostProcessor) {
289+
public B objectPostProcessor(ObjectPostProcessor<Object> objectPostProcessor) {
290290
Assert.notNull(objectPostProcessor, "objectPostProcessor cannot be null");
291291
this.objectPostProcessor = objectPostProcessor;
292-
return (O) this;
292+
return (B) this;
293293
}
294294

295295
/**

0 commit comments

Comments
 (0)