Deprecate Kotlin methods that don't use reified types

Closes gh-10365
This commit is contained in:
Eleftheria Stein 2021-10-13 10:16:37 +02:00
parent 7b98c2ea95
commit ba8844a67e
2 changed files with 9 additions and 1 deletions

View File

@ -725,6 +725,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
* @param atFilter the location of another [Filter] that is already registered
* (i.e. known) with Spring Security.
*/
@Deprecated("Use 'addFilterAt<T>(filter)' instead.")
fun addFilterAt(filter: Filter, atFilter: Class<out Filter>) {
this.http.addFilterAt(filter, atFilter)
}
@ -751,6 +752,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
* @param T the location of another [Filter] that is already registered
* (i.e. known) with Spring Security.
*/
@Suppress("DEPRECATION")
inline fun <reified T: Filter> addFilterAt(filter: Filter) {
this.addFilterAt(filter, T::class.java)
}
@ -776,6 +778,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
* @param afterFilter the location of another [Filter] that is already registered
* (i.e. known) with Spring Security.
*/
@Deprecated("Use 'addFilterAfter<T>(filter)' instead.")
fun addFilterAfter(filter: Filter, afterFilter: Class<out Filter>) {
this.http.addFilterAfter(filter, afterFilter)
}
@ -802,6 +805,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
* @param T the location of another [Filter] that is already registered
* (i.e. known) with Spring Security.
*/
@Suppress("DEPRECATION")
inline fun <reified T: Filter> addFilterAfter(filter: Filter) {
this.addFilterAfter(filter, T::class.java)
}
@ -827,6 +831,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
* @param beforeFilter the location of another [Filter] that is already registered
* (i.e. known) with Spring Security.
*/
@Deprecated("Use 'addFilterBefore<T>(filter)' instead.")
fun addFilterBefore(filter: Filter, beforeFilter: Class<out Filter>) {
this.http.addFilterBefore(filter, beforeFilter)
}
@ -853,6 +858,7 @@ class HttpSecurityDsl(private val http: HttpSecurity, private val init: HttpSecu
* @param T the location of another [Filter] that is already registered
* (i.e. known) with Spring Security.
*/
@Suppress("DEPRECATION")
inline fun <reified T: Filter> addFilterBefore(filter: Filter) {
this.addFilterBefore(filter, T::class.java)
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -53,6 +53,7 @@ class UserInfoEndpointDsl {
* @param customUserType a custom [OAuth2User] type
* @param clientRegistrationId the client registration identifier
*/
@Deprecated("Use 'customUserType<T>(clientRegistrationId)' instead.")
fun customUserType(customUserType: Class<out OAuth2User>, clientRegistrationId: String) {
customUserTypePair = Pair(customUserType, clientRegistrationId)
}
@ -65,6 +66,7 @@ class UserInfoEndpointDsl {
* @param T a custom [OAuth2User] type
* @param clientRegistrationId the client registration identifier
*/
@Suppress("DEPRECATION")
inline fun <reified T: OAuth2User> customUserType(clientRegistrationId: String) {
customUserType(T::class.java, clientRegistrationId)
}