Redundant modality modifier inspection #KT-11450 Fixed

This commit is contained in:
Mikhail Glukhikh
2016-04-06 17:24:05 +03:00
parent 8a0641a639
commit d79e3f322f
15 changed files with 267 additions and 25 deletions
@@ -0,0 +1,74 @@
<problems>
<problem>
<file>redundantModalityModifier.kt</file>
<line>4</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>13</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>22</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>25</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>29</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>31</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>33</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>39</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
<problem>
<file>redundantModalityModifier.kt</file>
<line>41</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/redundantModalityModifier.kt" />
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant modality modifier</problem_class>
<description>Redundant modality modifier</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.RedundantModalityModifierInspection
@@ -0,0 +1,42 @@
// Abstract
abstract class Base {
// Redundant final
final fun foo() {}
// Abstract
abstract fun bar()
// Open
open val gav = 42
}
class FinalDerived : Base() {
// Redundant final
override final fun bar() {}
// Non-final member in final class
override open val gav = 13
}
// Open
open class OpenDerived : Base() {
// Final
override final fun bar() {}
// Redundant open
override open val gav = 13
}
// Redundant final
final class Final
// Interface
interface Interface {
// Redundant
abstract fun foo()
// Redundant
private final fun bar() {}
// Redundant
open val gav: Int
get() = 42
}
// Derived interface
interface Derived : Interface {
// Redundant
override open fun foo() {}
// Redundant
final class Nested
}
@@ -0,0 +1 @@
org.jetbrains.kotlin.idea.inspections.RedundantModalityModifierInspection
@@ -0,0 +1,4 @@
// "Remove redundant modality modifier" "true"
open class C {
<caret>final fun foo(){}
}
@@ -0,0 +1,4 @@
// "Remove redundant modality modifier" "true"
open class C {
fun foo(){}
}