Ver Fonte

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.
BELHAKEL Ammar há 5 anos atrás
pai
commit
b4619f31ee

+ 2 - 2
config/src/main/java/org/springframework/security/config/annotation/AbstractConfiguredSecurityBuilder.java

@@ -286,10 +286,10 @@ public abstract class AbstractConfiguredSecurityBuilder<O, B extends SecurityBui
 	 * @return the {@link SecurityBuilder} for further customizations
 	 */
 	@SuppressWarnings("unchecked")
-	public O objectPostProcessor(ObjectPostProcessor<Object> objectPostProcessor) {
+	public B objectPostProcessor(ObjectPostProcessor<Object> objectPostProcessor) {
 		Assert.notNull(objectPostProcessor, "objectPostProcessor cannot be null");
 		this.objectPostProcessor = objectPostProcessor;
-		return (O) this;
+		return (B) this;
 	}
 
 	/**