diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.groovy index a5933a1f06f5..8b4c16c5e670 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/compiler/GroovyCompilerTestCase.groovy @@ -1,17 +1,5 @@ /* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. */ package org.jetbrains.plugins.groovy.compiler @@ -46,6 +34,7 @@ import com.intellij.testFramework.builders.JavaModuleFixtureBuilder import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase import com.intellij.util.SystemProperties import com.intellij.util.io.PathKt +import com.intellij.util.lang.JavaVersion import groovy.transform.CompileStatic import org.jetbrains.annotations.NotNull import org.jetbrains.annotations.Nullable @@ -53,6 +42,7 @@ import org.jetbrains.plugins.groovy.config.GroovyFacetUtil import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfiguration import org.jetbrains.plugins.groovy.runner.GroovyScriptRunConfigurationType import org.jetbrains.plugins.groovy.util.Slow + /** * @author aalmiray * @author peter @@ -81,7 +71,7 @@ abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestCase imp @Override protected void tuneFixture(JavaModuleFixtureBuilder moduleBuilder) throws Exception { - moduleBuilder.setLanguageLevel(JavaSdkVersion.fromVersionString(SystemProperties.javaVersion).maxLanguageLevel) + moduleBuilder.setLanguageLevel(JavaSdkVersion.fromJavaVersion(JavaVersion.current()).maxLanguageLevel) def javaHome = FileUtil.toSystemIndependentName(SystemProperties.javaHome) moduleBuilder.addJdk(StringUtil.trimEnd(StringUtil.trimEnd(javaHome, '/'), '/jre')) super.tuneFixture(moduleBuilder) @@ -223,9 +213,9 @@ abstract class GroovyCompilerTestCase extends JavaCodeInsightFixtureTestCase imp }, ProgramRunner.PROGRAM_RUNNER_EP.findExtension(DefaultJavaProgramRunner.class)) process.waitFor() def output = StringUtil.convertLineSeparators(sb.toString().trim()).readLines() - output = output.findAll { line -> - !StringUtil.containsIgnoreCase(line, "illegal") && - !line.contains("consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass") + output = output.findAll { line -> + !StringUtil.containsIgnoreCase(line, "illegal") && + !line.contains("consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass") } assertEquals(expected.trim(), output.join("\n")) } diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java index f1fcd76f53c0..4b872535311a 100644 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java +++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderImpl.java @@ -29,6 +29,7 @@ import com.intellij.psi.util.PsiModificationTracker; import com.intellij.psi.util.PsiUtilCore; import com.intellij.util.Query; import com.intellij.util.containers.ContainerUtil; +import com.intellij.util.lang.JavaVersion; import com.intellij.util.xml.NanoXmlUtil; import com.oracle.javafx.scenebuilder.kit.editor.EditorController; import com.oracle.javafx.scenebuilder.kit.editor.panel.content.ContentPanelController; @@ -185,8 +186,8 @@ public class SceneBuilderImpl implements SceneBuilder { // Take custom components from libraries, but not from the project modules, because SceneBuilder instantiates the components' classes. // Modules might be not compiled or may change since last compile, it's too expensive to keep track of that. final GlobalSearchScope scope = ProjectScope.getLibrariesScope(nodeClass.getProject()); - final String ideJdkVersion = Object.class.getPackage().getSpecificationVersion(); - final LanguageLevel ideLanguageLevel = LanguageLevel.parse(ideJdkVersion); + final JavaSdkVersion ideJdkVersion = JavaSdkVersion.fromJavaVersion(JavaVersion.current()); + final LanguageLevel ideLanguageLevel = ideJdkVersion != null ? ideJdkVersion.getMaxLanguageLevel() : null; final Query query = ClassInheritorsSearch.search(nodeClass, scope, true, true, false); final Set result = new THashSet<>(); query.forEach(psiClass -> {