Search in sources :

Example 1 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class TypeMigrationByThreadLocalRuleTest method testLanguageLevel.

public void testLanguageLevel() throws Exception {
    final LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(getProject());
    final LanguageLevel languageLevel = extension.getLanguageLevel();
    try {
        extension.setLanguageLevel(LanguageLevel.JDK_1_3);
        doTestFieldType("i", myJavaFacade.getElementFactory().createTypeFromText("java.lang.ThreadLocal", null));
    } finally {
        extension.setLanguageLevel(languageLevel);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Example 2 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class BooleanMethodInvertedTest method testMethodReferenceIgnored.

public void testMethodReferenceIgnored() throws Exception {
    final LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getJavaFacade().getProject());
    final LanguageLevel oldLevel = projectExtension.getLanguageLevel();
    try {
        projectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
        doTest();
    } finally {
        projectExtension.setLanguageLevel(oldLevel);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Example 3 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class UnnecessaryParenthesesInspectionTest method test.

public void test() throws Exception {
    final UnnecessaryParenthesesInspection inspection = new UnnecessaryParenthesesInspection();
    inspection.ignoreParenthesesOnConditionals = true;
    final LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
    final LanguageLevel level = levelProjectExtension.getLanguageLevel();
    try {
        levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
        doTest("com/siyeh/igtest/style/unnecessary_parentheses", new LocalInspectionToolWrapper(inspection), "java 1.8");
    } finally {
        levelProjectExtension.setLanguageLevel(level);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper)

Example 4 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class InterfaceNeverImplementedInspectionTest method test.

public void test() throws Exception {
    final LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
    final LanguageLevel level = levelProjectExtension.getLanguageLevel();
    try {
        levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
        doTest("com/siyeh/igtest/inheritance/interface_never_implemented", new LocalInspectionToolWrapper(new InterfaceNeverImplementedInspection()), "java 1.8");
    } finally {
        levelProjectExtension.setLanguageLevel(level);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper)

Example 5 with LanguageLevelProjectExtension

use of com.intellij.openapi.roots.LanguageLevelProjectExtension in project intellij-community by JetBrains.

the class ExtractMethodTest method doTestWithJava17.

private void doTestWithJava17() throws Exception {
    LanguageLevelProjectExtension projectExtension = LanguageLevelProjectExtension.getInstance(getProject());
    LanguageLevel oldLevel = projectExtension.getLanguageLevel();
    try {
        projectExtension.setLanguageLevel(LanguageLevel.JDK_1_7);
        doTest();
    } finally {
        projectExtension.setLanguageLevel(oldLevel);
    }
}
Also used : LanguageLevel(com.intellij.pom.java.LanguageLevel) LanguageLevelProjectExtension(com.intellij.openapi.roots.LanguageLevelProjectExtension)

Aggregations

LanguageLevelProjectExtension (com.intellij.openapi.roots.LanguageLevelProjectExtension)31 LanguageLevel (com.intellij.pom.java.LanguageLevel)23 LocalInspectionToolWrapper (com.intellij.codeInspection.ex.LocalInspectionToolWrapper)3 DisposeAwareProjectChange (com.intellij.openapi.externalSystem.util.DisposeAwareProjectChange)3 ProjectRootManagerEx (com.intellij.openapi.roots.ex.ProjectRootManagerEx)3 JavaProjectData (com.intellij.externalSystem.JavaProjectData)2 Module (com.intellij.openapi.module.Module)2 JavaSdk (com.intellij.openapi.projectRoots.JavaSdk)2 Sdk (com.intellij.openapi.projectRoots.Sdk)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 ProjectEx (com.intellij.openapi.project.ex.ProjectEx)1 JavaSdkVersion (com.intellij.openapi.projectRoots.JavaSdkVersion)1 CompilerProjectExtension (com.intellij.openapi.roots.CompilerProjectExtension)1 LanguageLevelModuleExtension (com.intellij.openapi.roots.LanguageLevelModuleExtension)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 JavaModuleFixtureBuilder (com.intellij.testFramework.builders.JavaModuleFixtureBuilder)1 IdeaProjectTestFixture (com.intellij.testFramework.fixtures.IdeaProjectTestFixture)1 File (java.io.File)1 IOException (java.io.IOException)1