Provide inspection and quickfixes for usages of static fields which will be no longer accessible in future versions

For this inspection three kinds of fixes are potentially available:
- Add 'const' modifier to kotlin property
- Add '@JvmField' annotation to kotlin property
- Change field reference to getter invocation

In case user chooses to 'cleanup code', these fixes are prioritized in this order
This commit is contained in:
Pavel V. Talanov
2015-10-12 21:35:47 +03:00
parent 47cca7db1f
commit d603142cc6
44 changed files with 679 additions and 35 deletions
@@ -17,6 +17,7 @@
package org.jetbrains.kotlin.idea.test
import com.intellij.codeInsight.intention.IntentionAction
import com.intellij.psi.PsiFile
import com.intellij.testFramework.UsefulTestCase
import org.jetbrains.kotlin.diagnostics.Severity
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFully
@@ -42,7 +43,7 @@ public object DirectiveBasedActionUtils {
expectedErrors)
}
public fun checkAvailableActionsAreExpected(file: JetFile, availableActions: Collection<IntentionAction>) {
public fun checkAvailableActionsAreExpected(file: PsiFile, availableActions: Collection<IntentionAction>) {
val expectedActions = InTextDirectivesUtils.findLinesWithPrefixesRemoved(file.getText(), "// ACTION:").sorted()
UsefulTestCase.assertEmpty("Irrelevant actions should not be specified in ACTION directive for they are not checked anyway",
@@ -70,6 +71,11 @@ public object DirectiveBasedActionUtils {
"Inject language or reference",
"Suppress '",
"Run inspection on",
"Inspection '"
"Inspection '",
"Suppress for ",
"Suppress all ",
"Edit cleanup profile settings",
"Fix all '",
"Cleanup code"
)
}