Fix messages #KT-25177
This commit is contained in:
committed by
Anton Bannykh
parent
605736b6ba
commit
f2fec6b078
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection reports a redundant <b>asDynamic</b> call.
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,5 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection reports a suspicious <b>asDynamic</b> member invocation.
|
||||
</body>
|
||||
</html>
|
||||
@@ -2976,8 +2976,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection"
|
||||
displayName="Redundant 'asDynamic' call"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
@@ -2957,7 +2957,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantWithInspection"
|
||||
displayName="Redundant 'with' call"
|
||||
groupPath="Kotlin"
|
||||
@@ -2976,8 +2975,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection"
|
||||
displayName="Redundant 'asDynamic' call"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
@@ -2975,8 +2975,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection"
|
||||
displayName="Redundant 'asDynamic' call"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
@@ -2976,8 +2976,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection"
|
||||
displayName="Redundant 'asDynamic' call"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
@@ -2975,8 +2975,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection"
|
||||
displayName="Redundant 'asDynamic' call"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
@@ -2975,8 +2975,8 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection"
|
||||
displayName="Redundant 'asDynamic' call"
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
|
||||
@@ -2958,6 +2958,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.RedundantWithInspection"
|
||||
displayName="Redundant 'with' call"
|
||||
groupPath="Kotlin"
|
||||
@@ -2976,6 +2977,15 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<localInspection implementationClass="org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection"
|
||||
displayName="Suspicious 'asDynamic' member invocation"
|
||||
groupPath="Kotlin"
|
||||
groupName="Style issues"
|
||||
enabledByDefault="true"
|
||||
level="WEAK WARNING"
|
||||
language="kotlin"
|
||||
/>
|
||||
|
||||
<referenceImporter implementation="org.jetbrains.kotlin.idea.quickfix.KotlinReferenceImporter"/>
|
||||
|
||||
<fileType.fileViewProviderFactory filetype="KJSM" implementationClass="com.intellij.psi.ClassFileViewProviderFactory"/>
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ import org.jetbrains.kotlin.psi.callExpressionVisitor
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForSelector
|
||||
import org.jetbrains.kotlin.types.DynamicType
|
||||
|
||||
class RedundantAsDynamicInspection : AbstractKotlinInspection() {
|
||||
class SuspiciousAsDynamicInspection : AbstractKotlinInspection() {
|
||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean) =
|
||||
callExpressionVisitor(fun(call) {
|
||||
if (call.platform != JsPlatform) return
|
||||
@@ -26,7 +26,7 @@ class RedundantAsDynamicInspection : AbstractKotlinInspection() {
|
||||
if (call.getQualifiedExpressionForSelector()?.receiverExpression?.getCallableDescriptor()?.returnType !is DynamicType) return
|
||||
holder.registerProblem(
|
||||
call,
|
||||
"Redundant 'asDynamic' call",
|
||||
"Suspicious 'asDynamic' member invocation",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
RemoveAsDynamicCallFix()
|
||||
)
|
||||
@@ -34,7 +34,7 @@ class RedundantAsDynamicInspection : AbstractKotlinInspection() {
|
||||
}
|
||||
|
||||
private class RemoveAsDynamicCallFix : LocalQuickFix {
|
||||
override fun getName() = "Remove 'asDynamic' call"
|
||||
override fun getName() = "Remove 'asDynamic' invocation"
|
||||
|
||||
override fun getFamilyName() = name
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
org.jetbrains.kotlin.idea.inspections.RedundantAsDynamicInspection
|
||||
@@ -1,4 +0,0 @@
|
||||
// JS
|
||||
fun test(d: dynamic) {
|
||||
d.<caret>asDynamic().foo()
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
// JS
|
||||
fun test(d: dynamic) {
|
||||
d.foo()
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.kotlin.idea.inspections.SuspiciousAsDynamicInspection
|
||||
@@ -0,0 +1,6 @@
|
||||
// JS
|
||||
// PROBLEM: Suspicious 'asDynamic' member invocation
|
||||
// FIX: Remove 'asDynamic' invocation
|
||||
fun test(d: dynamic) {
|
||||
d.<caret>asDynamic().foo()
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
// JS
|
||||
// PROBLEM: Suspicious 'asDynamic' member invocation
|
||||
// FIX: Remove 'asDynamic' invocation
|
||||
fun test(d: dynamic) {
|
||||
d.foo()
|
||||
}
|
||||
+18
-18
@@ -3487,24 +3487,6 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/redundantAsDynamic")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class RedundantAsDynamic extends AbstractLocalInspectionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInRedundantAsDynamic() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/redundantAsDynamic"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/redundantAsDynamic/simple.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/redundantCompanionReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -5525,6 +5507,24 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/suspiciousAsDynamic")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class SuspiciousAsDynamic extends AbstractLocalInspectionTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSuspiciousAsDynamic() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/inspectionsLocal/suspiciousAsDynamic"), Pattern.compile("^([\\w\\-_]+)\\.(kt|kts)$"), TargetBackend.ANY, true);
|
||||
}
|
||||
|
||||
@TestMetadata("simple.kt")
|
||||
public void testSimple() throws Exception {
|
||||
runTest("idea/testData/inspectionsLocal/suspiciousAsDynamic/simple.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/inspectionsLocal/unnecessaryVariable")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user