Kotlin

Kotlin

Made by DeepSource

Detected member with protected visibility in final class KT-W1055

Anti-pattern
Minor

Kotlin classes are final by default. Thus, classes which are not marked as open should not contain protected members. If stricter visibility is desired, one should consider making the members private. On the other hand, if the member is a const property and visibility outside the class is not an issue, consider making it public.

Bad Practice

class ProtectedMemberInFinalClass {
    protected var i = 0
}

Recommended

Consider using private, internal, or public modifiers instead.

class ProtectedMemberInFinalClass {
    private var i = 0
}