Added MIN_JAVA_VERSION directive for intentions and fixed failed test(convertIfToAssert/inapplicableCauseSent.kt).
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
// IS_APPLICABLE: false
|
// IS_APPLICABLE: false
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
|
// MIN_JAVA_VERSION: 1.7
|
||||||
fun foo() {
|
fun foo() {
|
||||||
if <caret>(1 == 0) {
|
if <caret>(1 == 0) {
|
||||||
throw AssertionError("text", Exception())
|
throw AssertionError("text", Exception())
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.intellij.codeInsight.intention.IntentionAction;
|
|||||||
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
import com.intellij.openapi.editor.actionSystem.EditorActionHandler;
|
||||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||||
import com.intellij.openapi.projectRoots.Sdk;
|
import com.intellij.openapi.projectRoots.Sdk;
|
||||||
|
import com.intellij.openapi.util.SystemInfo;
|
||||||
import com.intellij.openapi.util.io.FileUtil;
|
import com.intellij.openapi.util.io.FileUtil;
|
||||||
import com.intellij.testFramework.LightCodeInsightTestCase;
|
import com.intellij.testFramework.LightCodeInsightTestCase;
|
||||||
import com.intellij.util.PathUtil;
|
import com.intellij.util.PathUtil;
|
||||||
@@ -261,6 +262,10 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
|
|||||||
configureByFile(path);
|
configureByFile(path);
|
||||||
|
|
||||||
String fileText = FileUtil.loadFile(new File(path), true);
|
String fileText = FileUtil.loadFile(new File(path), true);
|
||||||
|
|
||||||
|
String minJavaVersion = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// MIN_JAVA_VERSION: ");
|
||||||
|
if (minJavaVersion != null && !SystemInfo.isJavaVersionAtLeast(minJavaVersion)) return;
|
||||||
|
|
||||||
boolean isWithRuntime = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// WITH_RUNTIME") != null;
|
boolean isWithRuntime = InTextDirectivesUtils.findStringWithPrefixes(fileText, "// WITH_RUNTIME") != null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user