Skip to content

Kotlin Configuration DSL: Use reified types wherever a class is used as a parameter #8697

Closed
@gonozalviii

Description

@gonozalviii

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)).

Metadata

Metadata

Assignees

Labels

in: configAn issue in spring-security-configstatus: ideal-for-contributionAn issue that we actively are looking for someone to help us withtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions