From ab283f3cecf072d9d01ef5ee155d22cb1bd36615 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 24 Jan 2018 15:41:06 +0300 Subject: [PATCH] [java] adds language level 10 --- .../impl/JavaSoftKeywordHighlighting.kt | 18 ++---------- .../daemon/impl/analysis/HighlightUtil.java | 2 +- .../impl/analysis/HighlightVisitorImpl.java | 4 +-- ...dundantExplicitVariableTypeInspection.java | 4 +-- .../VariableTypeCanBeExplicitInspection.java | 4 +-- .../JavacQuirksInspectionVisitor.java | 29 ++++++------------- .../ide/actions/CreateClassAction.java | 23 +++------------ .../openapi/projectRoots/JavaSdkVersion.java | 4 +-- .../com/intellij/pom/java/LanguageLevel.java | 1 + .../graphInference/PsiPolyExpressionUtil.java | 28 +++++------------- .../src/messages/JavaCoreBundle.properties | 2 +- .../intellij/lang/java/lexer/JavaLexer.java | 18 ++---------- .../lang/java/parser/ReferenceParser.java | 18 ++---------- .../src/messages/JavaErrorMessages.properties | 1 + .../advHighlighting8/VarClassesWarning.java | 2 +- .../daemon/LightAdvLVTIHighlightingTest.java | 20 ++----------- ...antExplicitVariableTypeInspectionTest.java | 18 ++---------- ...riableTypeCanBeExplicitInspectionTest.java | 18 ++---------- .../util/io/java/impl/ClassFileBuilderImpl.kt | 4 +-- .../jps/model/java/LanguageLevel.java | 2 +- 20 files changed, 49 insertions(+), 171 deletions(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaSoftKeywordHighlighting.kt b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaSoftKeywordHighlighting.kt index 171cff8d2934..57a6640420b9 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaSoftKeywordHighlighting.kt +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/JavaSoftKeywordHighlighting.kt @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.codeInsight.daemon.impl import com.intellij.codeHighlighting.TextEditorHighlightingPass @@ -37,7 +23,7 @@ class JavaSoftKeywordHighlightingPassFactory(project: Project, registrar: TextEd override fun createHighlightingPass(file: PsiFile, editor: Editor): TextEditorHighlightingPass? { val visit = file is PsiJavaFile && (file.name == PsiJavaModule.MODULE_INFO_FILE && file.languageLevel.isAtLeast(LanguageLevel.JDK_1_9) || - file.languageLevel.isAtLeast(LanguageLevel.JDK_X)) + file.languageLevel.isAtLeast(LanguageLevel.JDK_10)) return if (visit) JavaSoftKeywordHighlightingPass(file as PsiJavaFile, editor.document) else null } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java index 940db1f4a8a5..fe136ed9ddb9 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightUtil.java @@ -415,7 +415,7 @@ public class HighlightUtil extends HighlightUtilBase { } static HighlightInfo checkLegalVarReference(PsiJavaCodeReferenceElement ref, @NotNull PsiClass resolved) { - if (PsiKeyword.VAR.equals(resolved.getName()) && PsiUtil.getLanguageLevel(ref).isAtLeast(LanguageLevel.JDK_X)) { + if (PsiKeyword.VAR.equals(resolved.getName()) && PsiUtil.getLanguageLevel(ref).isAtLeast(LanguageLevel.JDK_10)) { return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR) .descriptionAndTooltip("Illegal reference to restricted type 'var'") .range(ObjectUtils.notNull(ref.getReferenceNameElement(), ref)) diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java index ff05c213477e..989f339f3eb8 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// 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 com.intellij.codeInsight.daemon.impl.analysis; import com.intellij.codeHighlighting.Pass; @@ -651,7 +651,7 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh if (!(parent instanceof PsiAnonymousClass) && aClass.getNameIdentifier() == identifier) { myHolder.add(HighlightNamesUtil.highlightClassName(aClass, identifier, colorsScheme)); } - if (!myHolder.hasErrorResults() && myLanguageLevel.isAtLeast(LanguageLevel.JDK_X)) { + if (!myHolder.hasErrorResults() && myLanguageLevel.isAtLeast(LanguageLevel.JDK_10)) { myHolder.add(HighlightClassUtil.checkVarClassConflict(aClass, identifier)); } if (!myHolder.hasErrorResults() && myLanguageLevel.isAtLeast(LanguageLevel.JDK_1_8)) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantExplicitVariableTypeInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantExplicitVariableTypeInspection.java index 03bedb5c6e58..c4f84e62ad1f 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantExplicitVariableTypeInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantExplicitVariableTypeInspection.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// 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 com.intellij.codeInspection; import com.intellij.openapi.project.Project; @@ -13,7 +13,7 @@ public class RedundantExplicitVariableTypeInspection extends AbstractBaseJavaLoc @NotNull @Override public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { - if (!PsiUtil.getLanguageLevel(holder.getFile()).isAtLeast(LanguageLevel.JDK_X)) { + if (!PsiUtil.getLanguageLevel(holder.getFile()).isAtLeast(LanguageLevel.JDK_10)) { return PsiElementVisitor.EMPTY_VISITOR; } return new JavaElementVisitor() { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/VariableTypeCanBeExplicitInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/VariableTypeCanBeExplicitInspection.java index 2c25b092a824..cbd03a326b33 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/VariableTypeCanBeExplicitInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/VariableTypeCanBeExplicitInspection.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// 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 com.intellij.codeInspection; import com.intellij.openapi.project.Project; @@ -15,7 +15,7 @@ public class VariableTypeCanBeExplicitInspection extends AbstractBaseJavaLocalIn @NotNull @Override public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { - if (!PsiUtil.getLanguageLevel(holder.getFile()).isAtLeast(LanguageLevel.JDK_X)) { + if (!PsiUtil.getLanguageLevel(holder.getFile()).isAtLeast(LanguageLevel.JDK_10)) { return PsiElementVisitor.EMPTY_VISITOR; } PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(holder.getProject()); diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/compiler/JavacQuirksInspectionVisitor.java b/java/java-analysis-impl/src/com/intellij/codeInspection/compiler/JavacQuirksInspectionVisitor.java index 02ea9fe434ed..5937e7edb402 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/compiler/JavacQuirksInspectionVisitor.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/compiler/JavacQuirksInspectionVisitor.java @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.codeInspection.compiler; import com.intellij.codeInsight.daemon.JavaErrorMessages; @@ -177,14 +163,17 @@ public class JavacQuirksInspectionVisitor extends JavaElementVisitor { public void visitIdentifier(PsiIdentifier identifier) { super.visitIdentifier(identifier); if ("_".equals(identifier.getText()) && - mySdkVersion != null && mySdkVersion.isAtLeast(JavaSdkVersion.JDK_1_8) && + mySdkVersion != null && + mySdkVersion.isAtLeast(JavaSdkVersion.JDK_1_8) && myLanguageLevel.isLessThan(LanguageLevel.JDK_1_9)) { - final String message = JavaErrorMessages.message("underscore.identifier.warn"); + String message = JavaErrorMessages.message("underscore.identifier.warn"); myHolder.registerProblem(identifier, message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } - else if (identifier.getParent() instanceof PsiClass && "var".equals(identifier.getText()) && - myLanguageLevel.isLessThan(LanguageLevel.JDK_X)) { - myHolder.registerProblem(identifier, "Usage of 'var' as class name might not be supported in releases after java 9"); + if ("var".equals(identifier.getText()) && + identifier.getParent() instanceof PsiClass && + myLanguageLevel.isLessThan(LanguageLevel.JDK_10)) { + String message = JavaErrorMessages.message("var.identifier.warn"); + myHolder.registerProblem(identifier, message); } } diff --git a/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java b/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java index 5c4ab9acc26c..ad56f9bd10dc 100644 --- a/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java +++ b/java/java-impl/src/com/intellij/ide/actions/CreateClassAction.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2012 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 com.intellij.ide.actions; @@ -56,22 +42,21 @@ public class CreateClassAction extends JavaCreateTemplateInPackageAction 0 && !PsiNameHelper.getInstance(project).isQualifiedName(inputString)) { return "This is not a valid Java qualified name"; } - - if (level.isAtLeast(LanguageLevel.JDK_X) && PsiKeyword.VAR.equals(StringUtil.getShortName(inputString))) { + if (level.isAtLeast(LanguageLevel.JDK_10) && PsiKeyword.VAR.equals(StringUtil.getShortName(inputString))) { return "var cannot be used for type declarations"; } return null; diff --git a/java/java-psi-api/src/com/intellij/openapi/projectRoots/JavaSdkVersion.java b/java/java-psi-api/src/com/intellij/openapi/projectRoots/JavaSdkVersion.java index c9857cb13827..fcafbc5d9871 100644 --- a/java/java-psi-api/src/com/intellij/openapi/projectRoots/JavaSdkVersion.java +++ b/java/java-psi-api/src/com/intellij/openapi/projectRoots/JavaSdkVersion.java @@ -25,9 +25,9 @@ public enum JavaSdkVersion { JDK_1_7(LanguageLevel.JDK_1_7), JDK_1_8(LanguageLevel.JDK_1_8), JDK_1_9(LanguageLevel.JDK_1_9), - JDK_10(LanguageLevel.JDK_1_9); + JDK_10(LanguageLevel.JDK_10); - private static final JavaSdkVersion MAX_JDK = JDK_1_9; + private static final JavaSdkVersion MAX_JDK = JDK_10; private final LanguageLevel myMaxLanguageLevel; diff --git a/java/java-psi-api/src/com/intellij/pom/java/LanguageLevel.java b/java/java-psi-api/src/com/intellij/pom/java/LanguageLevel.java index 84ab564519ba..2d14c6beb817 100644 --- a/java/java-psi-api/src/com/intellij/pom/java/LanguageLevel.java +++ b/java/java-psi-api/src/com/intellij/pom/java/LanguageLevel.java @@ -28,6 +28,7 @@ public enum LanguageLevel { JDK_1_7(JavaCoreBundle.message("jdk.1.7.language.level.description")), JDK_1_8(JavaCoreBundle.message("jdk.1.8.language.level.description")), JDK_1_9(JavaCoreBundle.message("jdk.1.9.language.level.description")), + JDK_10(JavaCoreBundle.message("jdk.10.language.level.description")), JDK_X(JavaCoreBundle.message("jdk.X.language.level.description")); public static final LanguageLevel HIGHEST = JDK_1_9; diff --git a/java/java-psi-api/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java b/java/java-psi-api/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java index 186327da3f09..022f616fc7b9 100644 --- a/java/java-psi-api/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/impl/source/resolve/graphInference/PsiPolyExpressionUtil.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2013 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 com.intellij.psi.impl.source.resolve.graphInference; import com.intellij.pom.java.LanguageLevel; @@ -40,7 +26,7 @@ public class PsiPolyExpressionUtil { public static boolean isPolyExpression(final PsiExpression expression) { if (expression instanceof PsiFunctionalExpression) { return true; - } + } else if (expression instanceof PsiParenthesizedExpression) { return isPolyExpression(((PsiParenthesizedExpression)expression).getExpression()); } @@ -129,9 +115,9 @@ public class PsiPolyExpressionUtil { private static boolean isInAssignmentOrInvocationContext(PsiExpression expr) { final PsiElement context = PsiUtil.skipParenthesizedExprUp(expr.getParent()); - return context instanceof PsiExpressionList || - context instanceof PsiArrayInitializerExpression || - context instanceof PsiConditionalExpression && (expr instanceof PsiCallExpression || isPolyExpression((PsiExpression)context)) || + return context instanceof PsiExpressionList || + context instanceof PsiArrayInitializerExpression || + context instanceof PsiConditionalExpression && (expr instanceof PsiCallExpression || isPolyExpression((PsiExpression)context)) || isAssignmentContext(expr, context); } @@ -144,7 +130,7 @@ public class PsiPolyExpressionUtil { } private static boolean isVarContext(PsiVariable variable) { - if (PsiUtil.getLanguageLevel(variable).isAtLeast(LanguageLevel.JDK_X)) { + if (PsiUtil.getLanguageLevel(variable).isAtLeast(LanguageLevel.JDK_10)) { PsiTypeElement typeElement = variable.getTypeElement(); if (typeElement != null && typeElement.isInferredType()) { return true; @@ -152,7 +138,7 @@ public class PsiPolyExpressionUtil { } return false; } - + public static boolean isExpressionOfPrimitiveType(@Nullable PsiExpression arg) { if (arg != null && !isPolyExpression(arg)) { final PsiType type = arg.getType(); diff --git a/java/java-psi-api/src/messages/JavaCoreBundle.properties b/java/java-psi-api/src/messages/JavaCoreBundle.properties index c2e493169a82..5b1f89cab982 100644 --- a/java/java-psi-api/src/messages/JavaCoreBundle.properties +++ b/java/java-psi-api/src/messages/JavaCoreBundle.properties @@ -8,5 +8,5 @@ jdk.1.6.language.level.description=6 - @Override in interfaces jdk.1.7.language.level.description=7 - Diamonds, ARM, multi-catch etc. jdk.1.8.language.level.description=8 - Lambdas, type annotations etc. jdk.1.9.language.level.description=9 - Modules, private methods in interfaces etc. - +jdk.10.language.level.description=10 - Local variable type inference jdk.X.language.level.description=X - Experimental features diff --git a/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java b/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java index d7589fafb3e4..e2c0b66afa9c 100644 --- a/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java +++ b/java/java-psi-impl/src/com/intellij/lang/java/lexer/JavaLexer.java @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.lang.java.lexer; import com.intellij.lexer.LexerBase; @@ -51,7 +37,7 @@ public class JavaLexer extends LexerBase { public static boolean isSoftKeyword(CharSequence id, @NotNull LanguageLevel level) { return id != null && (level.isAtLeast(LanguageLevel.JDK_1_9) && JAVA9_KEYWORDS.contains(id) || - level.isAtLeast(LanguageLevel.JDK_X) && VAR.contentEquals(id)); + level.isAtLeast(LanguageLevel.JDK_10) && VAR.contentEquals(id)); } private final _JavaLexer myFlexLexer; diff --git a/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java b/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java index 66bdaa62d99a..85f8b90abb67 100644 --- a/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java +++ b/java/java-psi-impl/src/com/intellij/lang/java/parser/ReferenceParser.java @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.lang.java.parser; import com.intellij.codeInsight.daemon.JavaErrorMessages; @@ -105,7 +91,7 @@ public class ReferenceParser { if (tokenType == JavaTokenType.IDENTIFIER && isSet(flags, VAR_TYPE) && PsiKeyword.VAR.equals(builder.getTokenText()) && - getLanguageLevel(builder).isAtLeast(LanguageLevel.JDK_X)) { + getLanguageLevel(builder).isAtLeast(LanguageLevel.JDK_10)) { builder.remapCurrentToken(tokenType = JavaTokenType.VAR_KEYWORD); } else if (tokenType == JavaTokenType.VAR_KEYWORD && !isSet(flags, VAR_TYPE)) { diff --git a/java/java-psi-impl/src/messages/JavaErrorMessages.properties b/java/java-psi-impl/src/messages/JavaErrorMessages.properties index 5bfb30851a02..260d9d626789 100644 --- a/java/java-psi-impl/src/messages/JavaErrorMessages.properties +++ b/java/java-psi-impl/src/messages/JavaErrorMessages.properties @@ -401,6 +401,7 @@ declaration.not.allowed=Declaration not allowed here underscore.identifier.warn=Use of '_' as an identifier might not be supported in releases after Java 8 underscore.identifier.error=As of Java 9, '_' is a keyword, and may not be used as an identifier underscore.lambda.identifier=Use of '_' as a lambda parameter name is not allowed +var.identifier.warn=Usage of 'var' as class name might not be supported in releases after Java 9 module.no.package=A module file should not have 'package' statement module.file.wrong.name=Module declaration should be in a file named 'module-info.java' diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting8/VarClassesWarning.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting8/VarClassesWarning.java index 304826271091..213478617ec5 100644 --- a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting8/VarClassesWarning.java +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/advHighlighting8/VarClassesWarning.java @@ -1 +1 @@ -class var {} \ No newline at end of file +class var {} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvLVTIHighlightingTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvLVTIHighlightingTest.java index f375024fea60..ec43b93d3f0d 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvLVTIHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/LightAdvLVTIHighlightingTest.java @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.java.codeInsight.daemon; import com.intellij.codeInsight.daemon.LightDaemonAnalyzerTestCase; @@ -28,8 +14,8 @@ public class LightAdvLVTIHighlightingTest extends LightDaemonAnalyzerTestCase { @Override protected void setUp() throws Exception { super.setUp(); - setLanguageLevel(LanguageLevel.JDK_X); - IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), getTestRootDisposable()); + setLanguageLevel(LanguageLevel.JDK_10); + IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_10, getModule(), getTestRootDisposable()); } private void doTest() { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/RedundantExplicitVariableTypeInspectionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/RedundantExplicitVariableTypeInspectionTest.java index 5c91bec03535..1b4f356b8b52 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/RedundantExplicitVariableTypeInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/RedundantExplicitVariableTypeInspectionTest.java @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.java.codeInsight.daemon.quickFix; import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase; @@ -35,7 +21,7 @@ public class RedundantExplicitVariableTypeInspectionTest extends LightQuickFixPa @Override protected LanguageLevel getLanguageLevel() { - return LanguageLevel.JDK_X; + return LanguageLevel.JDK_10; } @Override diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/VariableTypeCanBeExplicitInspectionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/VariableTypeCanBeExplicitInspectionTest.java index d32205214af5..509a349d919d 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/VariableTypeCanBeExplicitInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/quickFix/VariableTypeCanBeExplicitInspectionTest.java @@ -1,18 +1,4 @@ -/* - * 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 com.intellij.java.codeInsight.daemon.quickFix; import com.intellij.codeInsight.daemon.quickFix.LightQuickFixParameterizedTestCase; @@ -35,7 +21,7 @@ public class VariableTypeCanBeExplicitInspectionTest extends LightQuickFixParame @Override protected LanguageLevel getLanguageLevel() { - return LanguageLevel.JDK_X; + return LanguageLevel.JDK_10; } @Override diff --git a/java/testFramework/src/com/intellij/util/io/java/impl/ClassFileBuilderImpl.kt b/java/testFramework/src/com/intellij/util/io/java/impl/ClassFileBuilderImpl.kt index de741d9c45bd..e129381533b1 100644 --- a/java/testFramework/src/com/intellij/util/io/java/impl/ClassFileBuilderImpl.kt +++ b/java/testFramework/src/com/intellij/util/io/java/impl/ClassFileBuilderImpl.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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. +// 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 com.intellij.util.io.java.impl import com.intellij.openapi.util.text.StringUtil @@ -65,7 +65,7 @@ private fun LanguageLevel.toAsmCode() = when (this) { LanguageLevel.JDK_1_7 -> Opcodes.V1_7 LanguageLevel.JDK_1_8 -> Opcodes.V1_8 LanguageLevel.JDK_1_9 -> Opcodes.V9 - LanguageLevel.JDK_X -> throw UnsupportedOperationException("Java 10 isn't supported yet") + else -> throw UnsupportedOperationException("${this} isn't supported yet") } private fun AccessModifier.toAsmCode() = when (this) { diff --git a/jps/model-api/src/org/jetbrains/jps/model/java/LanguageLevel.java b/jps/model-api/src/org/jetbrains/jps/model/java/LanguageLevel.java index 4bebe308f763..8ff9124b2af1 100644 --- a/jps/model-api/src/org/jetbrains/jps/model/java/LanguageLevel.java +++ b/jps/model-api/src/org/jetbrains/jps/model/java/LanguageLevel.java @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; * @author nik */ public enum LanguageLevel { - JDK_1_3, JDK_1_4, JDK_1_5, JDK_1_6, JDK_1_7, JDK_1_8, JDK_1_9, JDK_X; + JDK_1_3, JDK_1_4, JDK_1_5, JDK_1_6, JDK_1_7, JDK_1_8, JDK_1_9, JDK_10, JDK_X; @NotNull public JavaVersion toJavaVersion() {