Kotlin Configuration DSL: Use reified types wherever a class is used as a parameter #8697
Labels
in: config
An issue in spring-security-config
status: ideal-for-contribution
An issue that we actively are looking for someone to help us with
type: enhancement
A general enhancement
Milestone
Expected Behavior
Functions that take a class as a parameter could be written in a idiomatic kotlin way like
addFilterAt<BasicAuthenticationFilter>(myFilter)
also removing some noise.Current Behavior
The current version of the function takes a java class as a parameter:
addFilterAt(myFilter, BasicAuthenticationFilter::class.java)
Context
When using any Kotlin DSL I don't expect to pass a java class as a parameter. Normally you would pass Kotlins KClass (
BasicAuthenticationFilter::class
) or use the even more idiomatic way of with a generic reified type. That's also embraced in other parts of Spring like the RestTemplate that for example has an extension functions for post (postForObject(url)).The text was updated successfully, but these errors were encountered: