diff --git a/idea/resources/inspectionDescriptions/RedundantGetter.html b/idea/resources/inspectionDescriptions/RedundantGetter.html
new file mode 100644
index 00000000000..0b1ce78a976
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/RedundantGetter.html
@@ -0,0 +1,5 @@
+
+
+This inspection reports redundant property getter.
+
+
diff --git a/idea/resources/inspectionDescriptions/RedundantSetter.html b/idea/resources/inspectionDescriptions/RedundantSetter.html
new file mode 100644
index 00000000000..9154fb21b8c
--- /dev/null
+++ b/idea/resources/inspectionDescriptions/RedundantSetter.html
@@ -0,0 +1,5 @@
+
+
+This inspection reports redundant property setter.
+
+
diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 680891dbefb..a96f2ece588 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -2560,6 +2560,26 @@
language="kotlin"
/>
+
+
+
+
diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt
new file mode 100644
index 00000000000..7c0aa2eab9e
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantGetterInspection.kt
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2010-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.idea.inspections
+
+import com.intellij.codeInspection.*
+import com.intellij.openapi.project.Project
+import com.intellij.psi.PsiElementVisitor
+import org.jetbrains.kotlin.psi.*
+
+class RedundantGetterInspection : AbstractKotlinInspection() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
+ return object : KtVisitorVoid() {
+ override fun visitPropertyAccessor(accessor: KtPropertyAccessor) {
+ super.visitPropertyAccessor(accessor)
+ if (accessor.isRedundantGetter()) {
+ holder.registerProblem(accessor,
+ "Redundant getter",
+ ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
+ RemoveRedundantGetterFix())
+ }
+ }
+ }
+ }
+}
+
+private fun KtPropertyAccessor.isRedundantGetter(): Boolean {
+ if (!isGetter) return false
+ if (annotationEntries.isNotEmpty()) return false
+ val expression = bodyExpression ?: return true
+ if (expression is KtNameReferenceExpression) {
+ return expression.isFieldText()
+ }
+ if (expression is KtBlockExpression) {
+ val statement = expression.statements.takeIf { it.size == 1 }?.firstOrNull() ?: return false
+ val returnExpression = statement as? KtReturnExpression ?: return false
+ return returnExpression.returnedExpression?.isFieldText() == true
+ }
+ return false
+}
+
+private fun KtExpression.isFieldText(): Boolean = this.textMatches("field")
+
+private class RemoveRedundantGetterFix : LocalQuickFix {
+ override fun getName() = "Remove redundant getter"
+
+ override fun getFamilyName() = name
+
+ override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
+ val accessor = descriptor.psiElement as? KtPropertyAccessor ?: return
+ accessor.delete()
+ }
+}
\ No newline at end of file
diff --git a/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt
new file mode 100644
index 00000000000..567154cabdd
--- /dev/null
+++ b/idea/src/org/jetbrains/kotlin/idea/inspections/RedundantSetterInspection.kt
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010-2017 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.idea.inspections
+
+import com.intellij.codeInspection.*
+import com.intellij.openapi.project.Project
+import com.intellij.psi.PsiElementVisitor
+import org.jetbrains.kotlin.idea.references.mainReference
+import org.jetbrains.kotlin.lexer.KtTokens
+import org.jetbrains.kotlin.psi.*
+
+class RedundantSetterInspection : AbstractKotlinInspection() {
+ override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean, session: LocalInspectionToolSession): PsiElementVisitor {
+ return object : KtVisitorVoid() {
+ override fun visitPropertyAccessor(accessor: KtPropertyAccessor) {
+ super.visitPropertyAccessor(accessor)
+ if (accessor.isRedundantSetter()) {
+ holder.registerProblem(accessor,
+ "Redundant setter",
+ ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
+ RemoveRedundantSetterFix())
+ }
+ }
+ }
+ }
+}
+
+private fun KtPropertyAccessor.isRedundantSetter(): Boolean {
+ if (!isSetter) return false
+ if (annotationEntries.isNotEmpty()) return false
+ if (hasLowerVisibilityThanProperty()) return false
+ val expression = bodyExpression ?: return true
+ if (expression is KtBlockExpression) {
+ if (expression.statements.isEmpty()) return true
+ val statement = expression.statements.takeIf { it.size == 1 }?.firstOrNull() ?: return false
+ val parameter = valueParameters.takeIf { it.size == 1 }?.firstOrNull() ?: return false
+ val binaryExpression = statement as? KtBinaryExpression ?: return false
+ return binaryExpression.operationToken == KtTokens.EQ
+ && binaryExpression.left?.isFieldText() == true
+ && binaryExpression.right?.mainReference?.resolve() == parameter
+ }
+ return false
+}
+
+private fun KtPropertyAccessor.hasLowerVisibilityThanProperty(): Boolean {
+ val p = property
+ return when {
+ p.hasModifier(KtTokens.PRIVATE_KEYWORD) ->
+ false
+ p.hasModifier(KtTokens.PROTECTED_KEYWORD) ->
+ hasModifier(KtTokens.PRIVATE_KEYWORD)
+ p.hasModifier(KtTokens.INTERNAL_KEYWORD) ->
+ hasModifier(KtTokens.PRIVATE_KEYWORD) || hasModifier(KtTokens.PROTECTED_KEYWORD)
+ else ->
+ hasModifier(KtTokens.PRIVATE_KEYWORD) || hasModifier(KtTokens.PROTECTED_KEYWORD) || hasModifier(KtTokens.INTERNAL_KEYWORD)
+ }
+}
+
+private fun KtExpression.isFieldText(): Boolean = this.textMatches("field")
+
+private class RemoveRedundantSetterFix : LocalQuickFix {
+ override fun getName() = "Remove redundant setter"
+
+ override fun getFamilyName() = name
+
+ override fun applyFix(project: Project, descriptor: ProblemDescriptor) {
+ val accessor = descriptor.psiElement as? KtPropertyAccessor ?: return
+ accessor.delete()
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/.inspection b/idea/testData/inspectionsLocal/redundantGetter/.inspection
new file mode 100644
index 00000000000..41b268390df
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/.inspection
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.inspections.RedundantGetterInspection
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/annotation.kt b/idea/testData/inspectionsLocal/redundantGetter/annotation.kt
new file mode 100644
index 00000000000..ee166010db8
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/annotation.kt
@@ -0,0 +1,7 @@
+// PROBLEM: none
+annotation class Inject
+
+class Test {
+ val x = 1
+ @Inject get
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/default.kt b/idea/testData/inspectionsLocal/redundantGetter/default.kt
new file mode 100644
index 00000000000..b0c8bdfac78
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/default.kt
@@ -0,0 +1,4 @@
+class Test {
+ val x = 1
+ get
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/default.kt.after b/idea/testData/inspectionsLocal/redundantGetter/default.kt.after
new file mode 100644
index 00000000000..acd166d89a9
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/default.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ val x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt b/idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt
new file mode 100644
index 00000000000..d7fbde1b9bc
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt
@@ -0,0 +1,4 @@
+class Test {
+ val x = 1
+ get() = field
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt.after b/idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt.after
new file mode 100644
index 00000000000..acd166d89a9
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ val x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/notFieldExpression.kt b/idea/testData/inspectionsLocal/redundantGetter/notFieldExpression.kt
new file mode 100644
index 00000000000..cae16d1ebdf
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/notFieldExpression.kt
@@ -0,0 +1,4 @@
+// PROBLEM: none
+class Test {
+ val x: Int get() = 10
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/notOnlyReturnFieldBody.kt b/idea/testData/inspectionsLocal/redundantGetter/notOnlyReturnFieldBody.kt
new file mode 100644
index 00000000000..712610c52fc
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/notOnlyReturnFieldBody.kt
@@ -0,0 +1,10 @@
+// PROBLEM: none
+class Test {
+ val x = 1
+ get() {
+ foo()
+ return field
+ }
+
+ fun foo() {}
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt b/idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt
new file mode 100644
index 00000000000..079f8e71ff8
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt
@@ -0,0 +1,6 @@
+class Test {
+ val x = 1
+ get() {
+ return field
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt.after b/idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt.after
new file mode 100644
index 00000000000..acd166d89a9
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ val x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/.inspection b/idea/testData/inspectionsLocal/redundantSetter/.inspection
new file mode 100644
index 00000000000..70b26073213
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/.inspection
@@ -0,0 +1 @@
+org.jetbrains.kotlin.idea.inspections.RedundantSetterInspection
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/annotation.kt b/idea/testData/inspectionsLocal/redundantSetter/annotation.kt
new file mode 100644
index 00000000000..3b8f1bb785a
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/annotation.kt
@@ -0,0 +1,7 @@
+// PROBLEM: none
+annotation class Inject
+
+class Test {
+ var x = 1
+ @Inject set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/blankBody.kt b/idea/testData/inspectionsLocal/redundantSetter/blankBody.kt
new file mode 100644
index 00000000000..0a947d01f0d
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/blankBody.kt
@@ -0,0 +1,5 @@
+class Test {
+ var x = 1
+ set(value) {
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/blankBody.kt.after b/idea/testData/inspectionsLocal/redundantSetter/blankBody.kt.after
new file mode 100644
index 00000000000..53018233b00
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/blankBody.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ var x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/default.kt b/idea/testData/inspectionsLocal/redundantSetter/default.kt
new file mode 100644
index 00000000000..c95cbc3fe4b
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/default.kt
@@ -0,0 +1,4 @@
+class Test {
+ var x = 1
+ set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/default.kt.after b/idea/testData/inspectionsLocal/redundantSetter/default.kt.after
new file mode 100644
index 00000000000..53018233b00
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/default.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ var x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility1.kt b/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility1.kt
new file mode 100644
index 00000000000..a1e7ba80893
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility1.kt
@@ -0,0 +1,5 @@
+// PROBLEM: none
+class Test {
+ var x = 1
+ private set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility2.kt b/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility2.kt
new file mode 100644
index 00000000000..cd0688500ae
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility2.kt
@@ -0,0 +1,5 @@
+// PROBLEM: none
+class Test {
+ internal var x = 1
+ private set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility3.kt b/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility3.kt
new file mode 100644
index 00000000000..5e50785eb5b
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/lowerVisibility3.kt
@@ -0,0 +1,5 @@
+// PROBLEM: none
+class Test {
+ protected var x = 1
+ private set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/notOnlyReturnField.kt b/idea/testData/inspectionsLocal/redundantSetter/notOnlyReturnField.kt
new file mode 100644
index 00000000000..a96f108d322
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/notOnlyReturnField.kt
@@ -0,0 +1,10 @@
+// PROBLEM: none
+class Test {
+ var x = 1
+ set(value) {
+ foo()
+ field = value
+ }
+
+ fun foo() {}
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt b/idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt
new file mode 100644
index 00000000000..62124742254
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt
@@ -0,0 +1,6 @@
+class Test {
+ var x = 1
+ set(value) {
+ field = value
+ }
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt.after b/idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt.after
new file mode 100644
index 00000000000..53018233b00
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ var x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt
new file mode 100644
index 00000000000..d9e932cdeed
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt
@@ -0,0 +1,4 @@
+class Test {
+ internal var x = 1
+ internal set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt.after b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt.after
new file mode 100644
index 00000000000..25b911b6b39
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ internal var x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt
new file mode 100644
index 00000000000..d2f0534843a
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt
@@ -0,0 +1,4 @@
+class Test {
+ protected var x = 1
+ protected set
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt.after b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt.after
new file mode 100644
index 00000000000..2a9c7d354cf
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ protected var x = 1
+}
\ No newline at end of file
diff --git a/idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt
new file mode 100644
index 00000000000..94bc36d6fd5
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt
@@ -0,0 +1,4 @@
+class Test {
+ private var x = 1
+ private set
+}
diff --git a/idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt.after b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt.after
new file mode 100644
index 00000000000..70c7cd7c6c5
--- /dev/null
+++ b/idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt.after
@@ -0,0 +1,3 @@
+class Test {
+ private var x = 1
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
index 6b4d053e4b6..63983327a8a 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/inspections/LocalInspectionTestGenerated.java
@@ -1305,6 +1305,51 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
}
}
+ @TestMetadata("idea/testData/inspectionsLocal/redundantGetter")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class RedundantGetter extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInRedundantGetter() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/redundantGetter"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("annotation.kt")
+ public void testAnnotation() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantGetter/annotation.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("default.kt")
+ public void testDefault() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantGetter/default.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("fieldExpression.kt")
+ public void testFieldExpression() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantGetter/fieldExpression.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("notFieldExpression.kt")
+ public void testNotFieldExpression() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantGetter/notFieldExpression.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("notOnlyReturnFieldBody.kt")
+ public void testNotOnlyReturnFieldBody() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantGetter/notOnlyReturnFieldBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("onlyReturnFieldBody.kt")
+ public void testOnlyReturnFieldBody() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantGetter/onlyReturnFieldBody.kt");
+ doTest(fileName);
+ }
+ }
+
@TestMetadata("idea/testData/inspectionsLocal/redundantLambdaArrow")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -1395,6 +1440,81 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
}
}
+ @TestMetadata("idea/testData/inspectionsLocal/redundantSetter")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(JUnit3RunnerWithInners.class)
+ public static class RedundantSetter extends AbstractLocalInspectionTest {
+ public void testAllFilesPresentInRedundantSetter() throws Exception {
+ KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/redundantSetter"), Pattern.compile("^([\\w\\-_]+)\\.kt$"), TargetBackend.ANY, true);
+ }
+
+ @TestMetadata("annotation.kt")
+ public void testAnnotation() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/annotation.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("blankBody.kt")
+ public void testBlankBody() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/blankBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("default.kt")
+ public void testDefault() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/default.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lowerVisibility1.kt")
+ public void testLowerVisibility1() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/lowerVisibility1.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lowerVisibility2.kt")
+ public void testLowerVisibility2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/lowerVisibility2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("lowerVisibility3.kt")
+ public void testLowerVisibility3() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/lowerVisibility3.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("notOnlyReturnField.kt")
+ public void testNotOnlyReturnField() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/notOnlyReturnField.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("onlyReturnFieldBody.kt")
+ public void testOnlyReturnFieldBody() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/onlyReturnFieldBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("sameVisibility1.kt")
+ public void testSameVisibility1() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/sameVisibility1.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("sameVisibility2.kt")
+ public void testSameVisibility2() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/sameVisibility2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("sameVisibility3.kt")
+ public void testSameVisibility3() throws Exception {
+ String fileName = KotlinTestUtils.navigationMetadata("idea/testData/inspectionsLocal/redundantSetter/sameVisibility3.kt");
+ doTest(fileName);
+ }
+ }
+
@TestMetadata("idea/testData/inspectionsLocal/removeRedundantSpreadOperator")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)