Inheritance of AbstractAuthenticationBuilder in Kotlin

Author: ilia1243Created Sep 29, 2026Updated Sep 29, 2026
Labelsstatus: waiting-for-triagetype: enhancement

Expected Behavior

AbstractAuthenticationBuilder class should be public for it to be inherited by a public class in Kotlin.

Current Behavior

The following code

kotlin
open class Builder<B : Builder<B>>(token: MyAuthentication) : AbstractAuthenticationBuilder<B>(token) {
    ...
}

does not compile with error 'public' subclass exposes its 'protected (in AbstractAuthenticationToken)' supertype 'AbstractAuthenticationBuilder'..

Custom Builder class should in turn be public because it is exposed by public MyAuthentication.toBuilder() method.

Source: spring-projects/spring-security