Inspectopedia Help

'protected' visibility is effectively 'private' in a final class

Reports protected visibility used inside of a final class. In such cases protected members are accessible only in the class itself, so they are effectively private.


class FinalClass { protected fun foo() {} }

After the quick-fix is applied:

class FinalClass { private fun foo() {} }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Kotlin, @snapshot@

Last modified: 13 July 2023