Protected in final inspection: protected modifier is effectively private in final classes #KT-6674 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
20bac6178c
commit
a541aaafd8
@@ -0,0 +1,26 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>protectedInFinal.kt</file>
|
||||
<line>2</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/protectedInFinal.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'protected' visibility is effectively 'private' in a final class</problem_class>
|
||||
<description>'protected' visibility is effectively 'private' in a final class</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>protectedInFinal.kt</file>
|
||||
<line>4</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/protectedInFinal.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'protected' visibility is effectively 'private' in a final class</problem_class>
|
||||
<description>'protected' visibility is effectively 'private' in a final class</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>protectedInFinal.kt</file>
|
||||
<line>6</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/protectedInFinal.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'protected' visibility is effectively 'private' in a final class</problem_class>
|
||||
<description>'protected' visibility is effectively 'private' in a final class</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -0,0 +1 @@
|
||||
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.ProtectedInFinalInspection
|
||||
@@ -0,0 +1,37 @@
|
||||
class F {
|
||||
protected val foo: Int = 0
|
||||
|
||||
protected fun bar() {}
|
||||
|
||||
protected class Nested
|
||||
}
|
||||
|
||||
class G {
|
||||
interface H {
|
||||
protected val foo: Int = 0
|
||||
|
||||
protected fun bar() {}
|
||||
|
||||
protected class Nested
|
||||
}
|
||||
}
|
||||
|
||||
sealed class S {
|
||||
protected val foo: Int = 0
|
||||
|
||||
protected fun bar() {}
|
||||
|
||||
protected class Nested : S()
|
||||
|
||||
protected object Obj : S()
|
||||
}
|
||||
|
||||
enum class E {
|
||||
SINGLE {
|
||||
override val x = foo()
|
||||
};
|
||||
|
||||
abstract val x: Int
|
||||
|
||||
protected fun foo() = 42
|
||||
}
|
||||
Reference in New Issue
Block a user