Added MIN_JAVA_VERSION directive for intentions and fixed failed test(convertIfToAssert/inapplicableCauseSent.kt).

This commit is contained in:
Zalim Bashorov
2014-04-24 13:24:27 +04:00
parent f61db2decc
commit 525709bced
2 changed files with 7 additions and 1 deletions
@@ -1,7 +1,8 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
// MIN_JAVA_VERSION: 1.7
fun foo() {
if <caret>(1 == 0) {
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.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.testFramework.LightCodeInsightTestCase;
import com.intellij.util.PathUtil;
@@ -261,6 +262,10 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
configureByFile(path);
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;
try {