diff --git a/java/codeserver/core/src/com/intellij/java/codeserver/core/JavaPsiSwitchUtil.java b/java/codeserver/core/src/com/intellij/java/codeserver/core/JavaPsiSwitchUtil.java index 2f7c60490754..340790aca9a0 100644 --- a/java/codeserver/core/src/com/intellij/java/codeserver/core/JavaPsiSwitchUtil.java +++ b/java/codeserver/core/src/com/intellij/java/codeserver/core/JavaPsiSwitchUtil.java @@ -2,7 +2,7 @@ package com.intellij.java.codeserver.core; import com.intellij.codeInsight.ExpressionUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.Comparing; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.*; @@ -177,7 +177,7 @@ public final class JavaPsiSwitchUtil { if (!isOverWhomUnconditionalForSelector && ((!(overWhom instanceof PsiExpression expression) || ExpressionUtil.isNullLiteral(expression)) && who instanceof PsiKeyword && - PsiKeywords.DEFAULT.equals(who.getText()) || isInCaseNullDefaultLabel(who))) { + JavaKeywords.DEFAULT.equals(who.getText()) || isInCaseNullDefaultLabel(who))) { // JEP 440-441 // A 'default' label dominates a case label with a case pattern, // and it also dominates a case label with a null case constant. diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/AnnotationChecker.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/AnnotationChecker.java index 16a67f7facbb..fc6851ac8409 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/AnnotationChecker.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/AnnotationChecker.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.AnnotationTargetUtil; import com.intellij.codeInsight.AnnotationUtil; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds.AnnotationValueErrorContext; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.text.StringUtil; @@ -37,7 +37,7 @@ final class AnnotationChecker { psiElement().withParent(PsiNameValuePair.class), psiElement().withParents(PsiArrayInitializerMemberValue.class, PsiNameValuePair.class), psiElement().withParents(PsiArrayInitializerMemberValue.class, PsiAnnotationMethod.class), - psiElement().withParent(PsiAnnotationMethod.class).afterLeaf(PsiKeywords.DEFAULT), + psiElement().withParent(PsiAnnotationMethod.class).afterLeaf(JavaKeywords.DEFAULT), // Unterminated parameter list like "void test(@NotNull String)": error on annotation looks annoying here psiElement().withParents(PsiModifierList.class, PsiParameterList.class) ); diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ClassChecker.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ClassChecker.java index f92eec76e6cb..54989d3f8808 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ClassChecker.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ClassChecker.java @@ -7,7 +7,7 @@ import com.intellij.java.codeserver.core.JavaPsiModuleUtil; import com.intellij.java.codeserver.core.JavaPsiSingleFileSourceUtil; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKind; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.projectRoots.JavaSdkVersion; @@ -763,7 +763,7 @@ final class ClassChecker { void checkEnumSuperConstructorCall(@NotNull PsiMethodCallExpression expr) { PsiReferenceExpression methodExpression = expr.getMethodExpression(); PsiElement refNameElement = methodExpression.getReferenceNameElement(); - if (refNameElement != null && PsiKeywords.SUPER.equals(refNameElement.getText())) { + if (refNameElement != null && JavaKeywords.SUPER.equals(refNameElement.getText())) { PsiMember constructor = PsiUtil.findEnclosingConstructorOrInitializer(expr); if (constructor instanceof PsiMethod) { PsiClass aClass = constructor.getContainingClass(); diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java index 14d828b9fc50..1dbe7a8bb870 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/ExpressionChecker.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.ExceptionUtil; import com.intellij.core.JavaPsiBundle; import com.intellij.java.codeserver.core.JavaPsiReferenceUtil; import com.intellij.java.codeserver.highlighting.errors.*; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.IndexNotReadyException; @@ -948,12 +948,12 @@ final class ExpressionChecker { //do not highlight the 'module' keyword if the statement is not complete //see com.intellij.lang.java.parser.BasicFileParser.parseImportStatement - if (PsiKeywords.MODULE.equals(ref.getText()) && ref.getParent() instanceof PsiImportStatement && + if (JavaKeywords.MODULE.equals(ref.getText()) && ref.getParent() instanceof PsiImportStatement && PsiUtil.isAvailable(JavaFeature.MODULE_IMPORT_DECLARATIONS, ref)) { PsiElement importKeywordExpected = PsiTreeUtil.skipWhitespacesAndCommentsBackward(ref); PsiElement errorElementExpected = PsiTreeUtil.skipWhitespacesAndCommentsForward(ref); if (importKeywordExpected instanceof PsiKeyword keyword && - keyword.textMatches(PsiKeywords.IMPORT) && + keyword.textMatches(JavaKeywords.IMPORT) && errorElementExpected instanceof PsiErrorElement errorElement && JavaPsiBundle.message("expected.identifier.or.semicolon").equals(errorElement.getErrorDescription())) { return; @@ -1461,7 +1461,7 @@ final class ExpressionChecker { PsiElement parent = expression.getParent(); if (expression instanceof PsiJavaCodeReferenceElement referenceElement) { // redirected ctr - if (PsiKeywords.THIS.equals(referenceElement.getReferenceName()) + if (JavaKeywords.THIS.equals(referenceElement.getReferenceName()) && resolved instanceof PsiMethod psiMethod && psiMethod.isConstructor()) { return; @@ -1514,7 +1514,7 @@ final class ExpressionChecker { && PsiUtil.isInnerClass(superClass) && InheritanceUtil.isInheritorOrSelf(referencedClass, superClass.getContainingClass(), true)) { // by default super() is considered "this"-qualified - resolvedName = PsiKeywords.THIS; + resolvedName = JavaKeywords.THIS; } else { return; @@ -1524,8 +1524,8 @@ final class ExpressionChecker { resolvedName = qualifier.getText(); } } - else if (PsiKeywords.THIS.equals(name)) { - resolvedName = PsiKeywords.THIS; + else if (JavaKeywords.THIS.equals(name)) { + resolvedName = JavaKeywords.THIS; } else { resolvedName = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, @@ -1546,7 +1546,7 @@ final class ExpressionChecker { } else if (expression instanceof PsiQualifiedExpression qualifiedExpression) { referencedClass = PsiUtil.resolveClassInType(qualifiedExpression.getType()); - String keyword = expression instanceof PsiThisExpression ? PsiKeywords.THIS : PsiKeywords.SUPER; + String keyword = expression instanceof PsiThisExpression ? JavaKeywords.THIS : JavaKeywords.SUPER; PsiJavaCodeReferenceElement qualifier = qualifiedExpression.getQualifier(); resolvedName = qualifier != null && qualifier.resolve() instanceof PsiClass aClass ? PsiFormatUtil.formatClass(aClass, PsiFormatUtilBase.SHOW_NAME) + "." + keyword diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaErrorVisitor.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaErrorVisitor.java index 2fc5a03c7d81..331bdbe96258 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaErrorVisitor.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaErrorVisitor.java @@ -7,7 +7,7 @@ import com.intellij.java.codeserver.core.JavaPsiModuleUtil; import com.intellij.java.codeserver.highlighting.errors.JavaCompilationError; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; import com.intellij.java.codeserver.highlighting.errors.JavaIncompatibleTypeErrorContext; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.IndexNotReadyException; @@ -357,7 +357,7 @@ final class JavaErrorVisitor extends JavaElementVisitor { if (!hasErrorResults() && expression.getParent() instanceof PsiCaseLabelElementList && - expression.textMatches(PsiKeywords.NULL)) { + expression.textMatches(JavaKeywords.NULL)) { checkFeature(expression, JavaFeature.PATTERNS_IN_SWITCH); } diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaSyntaxErrorChecker.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaSyntaxErrorChecker.java index f83e5f846a4e..6da022bb5428 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaSyntaxErrorChecker.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/JavaSyntaxErrorChecker.java @@ -2,7 +2,7 @@ package com.intellij.java.codeserver.highlighting; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.JavaDocElementType; @@ -41,7 +41,7 @@ public final class JavaSyntaxErrorChecker { } else if (description.equals(JavaPsiBundle.message("expected.class.or.interface"))) { String text = element.getText(); - if ((text.equals(PsiKeywords.SEALED) || text.equals(PsiKeywords.NON_SEALED) || text.equals(PsiKeywords.VALUE)) && + if ((text.equals(JavaKeywords.SEALED) || text.equals(JavaKeywords.NON_SEALED) || text.equals(JavaKeywords.VALUE)) && PsiTreeUtil.skipWhitespacesAndCommentsForward(element) instanceof PsiClass) { return false; } diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/TypeChecker.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/TypeChecker.java index 0a4b2153e9c1..d526bb6c2fb1 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/TypeChecker.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/TypeChecker.java @@ -2,7 +2,7 @@ package com.intellij.java.codeserver.highlighting; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.impl.IncompleteModelUtil; import com.intellij.psi.util.PsiTreeUtil; @@ -157,7 +157,7 @@ final class TypeChecker { } void checkIllegalVoidType(@NotNull PsiKeyword type) { - if (!PsiKeywords.VOID.equals(type.getText())) return; + if (!JavaKeywords.VOID.equals(type.getText())) return; PsiElement parent = type.getParent(); if (parent instanceof PsiErrorElement) return; diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.java index 345e07e9ec76..ce205fdb50a7 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorFormatUtil.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.ContainerProvider; import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; import com.intellij.codeInsight.highlighting.HighlightUsagesDescriptionLocation; import com.intellij.java.codeserver.highlighting.JavaCompilationErrorBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.NlsSafe; @@ -212,7 +212,7 @@ final class JavaErrorFormatUtil { } static @NotNull String formatType(@Nullable PsiType type) { - return type == null ? PsiKeywords.NULL : PsiTypesUtil.removeExternalAnnotations(type).getInternalCanonicalText(); + return type == null ? JavaKeywords.NULL : PsiTypesUtil.removeExternalAnnotations(type).getInternalCanonicalText(); } static @NlsSafe @NotNull String format(@NotNull PsiElement element) { diff --git a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorKinds.java b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorKinds.java index e9a1c9e5188d..128cd7f2a7cd 100644 --- a/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorKinds.java +++ b/java/codeserver/highlighting/src/com/intellij/java/codeserver/highlighting/errors/JavaErrorKinds.java @@ -11,7 +11,7 @@ import com.intellij.java.codeserver.core.JpmsModuleAccessInfo; import com.intellij.java.codeserver.highlighting.JavaCompilationErrorBundle; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKind.Parameterized; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKind.Simple; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.projectRoots.JavaSdkVersion; import com.intellij.openapi.util.NlsSafe; import com.intellij.openapi.util.TextRange; @@ -146,7 +146,7 @@ public final class JavaErrorKinds { } else { PsiType type = ((PsiExpression)value).getType(); - text = type == null ? PsiKeywords.NULL : PsiTypesUtil.removeExternalAnnotations(type).getInternalCanonicalText(); + text = type == null ? JavaKeywords.NULL : PsiTypesUtil.removeExternalAnnotations(type).getInternalCanonicalText(); } return message("annotation.attribute.incompatible.type", context.typeText(), text); }); @@ -445,7 +445,7 @@ public final class JavaErrorKinds { parameterized(PsiElement.class, ClassStaticReferenceErrorContext.class, "class.cannot.be.referenced.from.static.context") .withDescription((psi, ctx) -> message( "class.cannot.be.referenced.from.static.context", - formatClass(ctx.outerClass()) + "." + (psi instanceof PsiSuperExpression ? PsiKeywords.SUPER : PsiKeywords.THIS))); + formatClass(ctx.outerClass()) + "." + (psi instanceof PsiSuperExpression ? JavaKeywords.SUPER : JavaKeywords.THIS))); public static final Parameterized CLASS_INHERITANCE_DIFFERENT_TYPE_ARGUMENTS = parameterized(PsiClass.class, InheritTypeClashContext.class, "class.inheritance.different.type.arguments") .withRange((cls, ctx) -> getClassDeclarationTextRange(cls)) @@ -1003,7 +1003,7 @@ public final class JavaErrorKinds { return switch (specialValue) { case UNCONDITIONAL_PATTERN -> message("switch.label.duplicate.unconditional.pattern"); case DEFAULT_VALUE -> message("switch.label.duplicate.default"); - case NULL_VALUE -> message("switch.label.duplicate", PsiKeywords.NULL); + case NULL_VALUE -> message("switch.label.duplicate", JavaKeywords.NULL); }; } else if (value instanceof PsiEnumConstant constant) { diff --git a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java index 0bdfd345d746..e7bf41668bd3 100644 --- a/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java +++ b/java/compiler/impl/src/com/intellij/compiler/chainsSearch/completion/lookup/ChainCompletionNewVariableLookupElement.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.completion.PreferByKindWeigher; import com.intellij.codeInsight.lookup.AutoCompletionPolicy; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.compiler.chainsSearch.context.ChainCompletionContext; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.codeStyle.JavaCodeStyleManager; @@ -65,7 +65,7 @@ public class ChainCompletionNewVariableLookupElement extends LookupElement { Objects.requireNonNull(PsiTreeUtil.getParentOfType(caretElement.getPrevSibling(), PsiStatement.class, false)); newVarDeclarationTemplate = elementFactory.createVariableDeclarationStatement(myNewVarName, elementFactory.createType(myQualifierClass), - elementFactory.createExpressionFromText(PsiKeywords.NULL, null)); + elementFactory.createExpressionFromText(JavaKeywords.NULL, null)); } diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java b/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java index 1f54275871ea..640db18b89c8 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java @@ -8,7 +8,7 @@ import com.intellij.debugger.engine.StackFrameContext; import com.intellij.debugger.engine.evaluation.EvaluateException; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.impl.SimpleStackFrameContext; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.*; @@ -529,7 +529,7 @@ public final class LocalVariablesUtil { } private static int getTypeSlotSize(String name) { - if (PsiKeywords.DOUBLE.equals(name) || PsiKeywords.LONG.equals(name)) { + if (JavaKeywords.DOUBLE.equals(name) || JavaKeywords.LONG.equals(name)) { return 2; } return 1; diff --git a/java/execution/openapi/src/com/intellij/execution/filters/AssertionErrorInfo.java b/java/execution/openapi/src/com/intellij/execution/filters/AssertionErrorInfo.java index 3910694b52da..8aa34f6f49e4 100644 --- a/java/execution/openapi/src/com/intellij/execution/filters/AssertionErrorInfo.java +++ b/java/execution/openapi/src/com/intellij/execution/filters/AssertionErrorInfo.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.filters; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.PsiAssertStatement; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiKeyword; @@ -15,7 +15,7 @@ public class AssertionErrorInfo extends ExceptionInfo { @Override ExceptionLineRefiner.RefinerMatchResult matchSpecificExceptionElement(@NotNull PsiElement e) { - if (e instanceof PsiKeyword && e.textMatches(PsiKeywords.ASSERT)) { + if (e instanceof PsiKeyword && e.textMatches(JavaKeywords.ASSERT)) { PsiAssertStatement statement = ObjectUtils.tryCast(e.getParent(), PsiAssertStatement.class); if (statement == null) { return null; diff --git a/java/execution/openapi/src/com/intellij/execution/filters/ExceptionInfo.java b/java/execution/openapi/src/com/intellij/execution/filters/ExceptionInfo.java index 6d59a81cd046..b13d24aaea3a 100644 --- a/java/execution/openapi/src/com/intellij/execution/filters/ExceptionInfo.java +++ b/java/execution/openapi/src/com/intellij/execution/filters/ExceptionInfo.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.filters; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Document; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.StringUtil; @@ -152,7 +152,7 @@ public class ExceptionInfo { public RefinerMatchResult matchElement(@NotNull PsiElement current) { PsiElement newException = findNewException(current); if (newException != null) return RefinerMatchResult.of(newException); - if (current instanceof PsiKeyword && current.textMatches(PsiKeywords.THROW)) { + if (current instanceof PsiKeyword && current.textMatches(JavaKeywords.THROW)) { PsiElement nextLeaf = PsiTreeUtil.nextVisibleLeaf(current); newException = findNewException(nextLeaf); if (newException != null) return onTheSameLineFor(current, newException, true); @@ -162,7 +162,7 @@ public class ExceptionInfo { private @Nullable PsiElement findNewException(PsiElement element) { // We look for new Exception() expression rather than throw statement, because stack-trace is filled in exception constructor - if (element instanceof PsiKeyword && element.textMatches(PsiKeywords.NEW)) { + if (element instanceof PsiKeyword && element.textMatches(JavaKeywords.NEW)) { PsiNewExpression newExpression = ObjectUtils.tryCast(element.getParent(), PsiNewExpression.class); if (newExpression != null) { PsiType type = newExpression.getType(); diff --git a/java/execution/openapi/src/com/intellij/execution/filters/NegativeArraySizeExceptionInfo.java b/java/execution/openapi/src/com/intellij/execution/filters/NegativeArraySizeExceptionInfo.java index 297aabae0ad6..dbe61a10e818 100644 --- a/java/execution/openapi/src/com/intellij/execution/filters/NegativeArraySizeExceptionInfo.java +++ b/java/execution/openapi/src/com/intellij/execution/filters/NegativeArraySizeExceptionInfo.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.filters; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; @@ -28,7 +28,7 @@ public class NegativeArraySizeExceptionInfo extends ExceptionInfo { PsiElement e = PsiTreeUtil.nextVisibleLeaf(current); if (e == null) return null; PsiExpression candidate = null; - if (e instanceof PsiKeyword && e.textMatches(PsiKeywords.NEW) && e.getParent() instanceof PsiNewExpression) { + if (e instanceof PsiKeyword && e.textMatches(JavaKeywords.NEW) && e.getParent() instanceof PsiNewExpression) { PsiExpression[] dimensions = ((PsiNewExpression)e.getParent()).getArrayDimensions(); for (PsiExpression dimension : dimensions) { if (dimension != null) { diff --git a/java/execution/openapi/src/com/intellij/execution/filters/NullPointerExceptionInfo.java b/java/execution/openapi/src/com/intellij/execution/filters/NullPointerExceptionInfo.java index 3236a7c121d9..fa52e4af3cd3 100644 --- a/java/execution/openapi/src/com/intellij/execution/filters/NullPointerExceptionInfo.java +++ b/java/execution/openapi/src/com/intellij/execution/filters/NullPointerExceptionInfo.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.execution.filters; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; @@ -225,7 +225,7 @@ public class NullPointerExceptionInfo extends ExceptionInfo { } else if (e instanceof PsiJavaToken && e.textMatches("(") && PsiTreeUtil.prevVisibleLeaf(e) instanceof PsiKeyword startSwitch && - startSwitch.textMatches(PsiKeywords.SWITCH)) { + startSwitch.textMatches(JavaKeywords.SWITCH)) { PsiSwitchBlock switchBlock = tryCast(startSwitch.getParent(), PsiSwitchBlock.class); if (switchBlock != null) { PsiExpression selector = switchBlock.getExpression(); @@ -241,7 +241,7 @@ public class NullPointerExceptionInfo extends ExceptionInfo { PsiTreeUtil.nextVisibleLeaf(e) instanceof PsiJavaToken dot && dot.getTokenType().equals(JavaTokenType.DOT) && PsiTreeUtil.nextVisibleLeaf(dot) instanceof PsiKeyword newKeyWord && - newKeyWord.textMatches(PsiKeywords.NEW)) { + newKeyWord.textMatches(JavaKeywords.NEW)) { // qualified new PsiNewExpression newExpression = tryCast(newKeyWord.getParent(), PsiNewExpression.class); if (newExpression != null) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/DefaultJavaErrorFixProvider.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/DefaultJavaErrorFixProvider.java index cb8eeece0d89..dd3a690dc42c 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/DefaultJavaErrorFixProvider.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/DefaultJavaErrorFixProvider.java @@ -20,7 +20,7 @@ import com.intellij.java.codeserver.core.JpmsModuleAccessInfo; import com.intellij.java.codeserver.highlighting.JavaErrorCollector; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKind; import com.intellij.java.codeserver.highlighting.errors.JavaMismatchedCallContext; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.jvm.JvmModifier; import com.intellij.lang.jvm.JvmModifiersOwner; import com.intellij.lang.jvm.actions.JvmElementActionFactories; @@ -714,7 +714,7 @@ public final class DefaultJavaErrorFixProvider extends AbstractJavaErrorFixProvi fixes(SWITCH_DOMINANCE_VIOLATION, (error, sink) -> { PsiElement who = error.context(); PsiCaseLabelElement overWhom = error.psi(); - if (who instanceof PsiKeyword && PsiKeywords.DEFAULT.equals(who.getText()) || + if (who instanceof PsiKeyword && JavaKeywords.DEFAULT.equals(who.getText()) || JavaPsiSwitchUtil.isInCaseNullDefaultLabel(who)) { PsiSwitchLabelStatementBase labelStatementBase = PsiTreeUtil.getParentOfType(who, PsiSwitchLabelStatementBase.class); if (labelStatementBase != null) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java index 9ea0be3ce9d2..bec181fbc042 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaHighlightUtil.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.daemon.impl.analysis; import com.intellij.java.analysis.JavaAnalysisBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; @@ -76,7 +76,7 @@ public final class JavaHighlightUtil { } public static @NotNull String formatType(@Nullable PsiType type) { - return type == null ? PsiKeywords.NULL : PsiTypesUtil.removeExternalAnnotations(type).getInternalCanonicalText(); + return type == null ? JavaKeywords.NULL : PsiTypesUtil.removeExternalAnnotations(type).getInternalCanonicalText(); } private static @Nullable PsiType getArrayInitializerType(@NotNull PsiArrayInitializerExpression element) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java index b6fc1fe44279..d28650430232 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaModuleGraphUtil.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.daemon.impl.analysis; import com.intellij.ide.highlighter.JavaClassFileType; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.java.codeserver.core.JavaPsiModuleUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.Language; import com.intellij.lang.java.JavaLanguage; import com.intellij.lang.jvm.JvmLanguage; @@ -104,9 +104,9 @@ public final class JavaModuleGraphUtil { if (to.equals(from.getName())) return false; if (!PsiNameHelper.isValidModuleName(to, from)) return false; if (alreadyContainsRequires(from, to)) return false; - PsiUtil.addModuleStatement(from, PsiKeywords.REQUIRES + " " + - (isStaticModule(to, scope) ? PsiKeywords.STATIC + " " : "") + - (isExported ? PsiKeywords.TRANSITIVE + " " : "") + + PsiUtil.addModuleStatement(from, JavaKeywords.REQUIRES + " " + + (isStaticModule(to, scope) ? JavaKeywords.STATIC + " " : "") + + (isExported ? JavaKeywords.TRANSITIVE + " " : "") + to); return true; } @@ -133,9 +133,9 @@ public final class JavaModuleGraphUtil { if (!PsiNameHelper.isValidModuleName(to.getName(), to)) return false; if (contains(from.getRequires(), to.getName())) return false; if (JavaPsiModuleUtil.reads(from, to)) return false; - PsiUtil.addModuleStatement(from, PsiKeywords.REQUIRES + " " + - (isStaticModule(to.getName(), scope) ? PsiKeywords.STATIC + " " : "") + - (isExported(from, to) ? PsiKeywords.TRANSITIVE + " " : "") + + PsiUtil.addModuleStatement(from, JavaKeywords.REQUIRES + " " + + (isStaticModule(to.getName(), scope) ? JavaKeywords.STATIC + " " : "") + + (isExported(from, to) ? JavaKeywords.TRANSITIVE + " " : "") + to.getName()); return true; } diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/MemberModel.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/MemberModel.java index 8f16c4c058fa..a29c18948bf0 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/MemberModel.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/MemberModel.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.daemon.impl.analysis; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.TextRange; import com.intellij.psi.*; import com.intellij.psi.impl.source.tree.ElementType; @@ -158,7 +158,7 @@ public class MemberModel { } private @Nullable PsiJavaToken parseThrowsClause(@Nullable PsiJavaToken token) { - if (!(token instanceof PsiKeyword) || !PsiKeywords.THROWS.equals(token.getText())) return token; + if (!(token instanceof PsiKeyword) || !JavaKeywords.THROWS.equals(token.getText())) return token; token = tryCast(nextChild(), PsiIdentifier.class); if (token == null) return null; token = tryCast(parseQualifiedType(nextChild()), PsiJavaToken.class); diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddModuleDirectiveFix.kt b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddModuleDirectiveFix.kt index 0e2da38df6ea..69fddd188085 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddModuleDirectiveFix.kt +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddModuleDirectiveFix.kt @@ -4,7 +4,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix import com.intellij.codeInsight.daemon.QuickFixBundle import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil import com.intellij.codeInspection.util.IntentionName -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.modcommand.ActionContext import com.intellij.modcommand.ModPsiUpdater import com.intellij.modcommand.Presentation @@ -41,7 +41,7 @@ class AddExportsDirectiveFix( module: PsiJavaModule, private val packageName: String, targetName: String -) : AddPackageAccessibilityFix(PsiKeywords.EXPORTS, module, packageName, targetName) { +) : AddPackageAccessibilityFix(JavaKeywords.EXPORTS, module, packageName, targetName) { override fun getText(): String = QuickFixBundle.message("module.info.add.exports.name", packageName) override fun invoke(context: ActionContext, module: PsiJavaModule, updater: ModPsiUpdater) { @@ -53,7 +53,7 @@ class AddOpensDirectiveFix( module: PsiJavaModule, private val packageName: String, targetName: String -) : AddPackageAccessibilityFix(PsiKeywords.OPENS, module, packageName, targetName) { +) : AddPackageAccessibilityFix(JavaKeywords.OPENS, module, packageName, targetName) { override fun getText(): String = QuickFixBundle.message("module.info.add.opens.name", packageName) override fun invoke(context: ActionContext, module: PsiJavaModule, updater: ModPsiUpdater) { @@ -90,7 +90,7 @@ class AddUsesDirectiveFix(module: PsiJavaModule, private val svcName: String) : override fun invoke(context: ActionContext, module: PsiJavaModule, updater: ModPsiUpdater) { if (module.uses.find { svcName == it.classReference?.qualifiedName } == null) { - PsiUtil.addModuleStatement(module, PsiKeywords.USES + ' ' + svcName) + PsiUtil.addModuleStatement(module, JavaKeywords.USES + ' ' + svcName) } } } \ No newline at end of file diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java index 4d866ba5499c..a334e4dd6579 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddTypeArgumentsConditionalFix.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.intention.CommonIntentionAction; import com.intellij.codeInsight.intention.PriorityAction; import com.intellij.java.analysis.JavaAnalysisBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.*; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; @@ -67,7 +67,7 @@ public class AddTypeArgumentsConditionalFix extends PsiUpdateModCommandAction statementsToMerge) { final List moduleNames = getModuleNames(statementsToMerge); if (!moduleNames.isEmpty()) { - return getKeyword() + ' ' + myPackageName + ' ' + PsiKeywords.TO + ' ' + joinUniqueNames(moduleNames); + return getKeyword() + ' ' + myPackageName + ' ' + JavaKeywords.TO + ' ' + joinUniqueNames(moduleNames); } else { return getKeyword() + ' ' + myPackageName; @@ -90,8 +90,8 @@ public class MergePackageAccessibilityStatementsFix private @NotNull String getKeyword() { return switch (myRole) { - case OPENS -> PsiKeywords.OPENS; - case EXPORTS -> PsiKeywords.EXPORTS; + case OPENS -> JavaKeywords.OPENS; + case EXPORTS -> JavaKeywords.EXPORTS; }; } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MergeProvidesStatementsFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MergeProvidesStatementsFix.java index 9924bbcab1e9..2cd3ae43ae54 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MergeProvidesStatementsFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MergeProvidesStatementsFix.java @@ -2,8 +2,11 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.daemon.QuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; -import com.intellij.psi.*; +import com.intellij.java.syntax.parser.JavaKeywords; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiJavaCodeReferenceElement; +import com.intellij.psi.PsiJavaModule; +import com.intellij.psi.PsiProvidesStatement; import one.util.streamex.StreamEx; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; @@ -22,19 +25,19 @@ public class MergeProvidesStatementsFix extends MergeModuleStatementsFix statementsToMerge) { final List implementationNames = getImplementationNames(statementsToMerge); LOG.assertTrue(!implementationNames.isEmpty()); - return PsiKeywords.PROVIDES + ' ' + myInterfaceName + ' ' + PsiKeywords.WITH + ' ' + joinUniqueNames(implementationNames); + return JavaKeywords.PROVIDES + ' ' + myInterfaceName + ' ' + JavaKeywords.WITH + ' ' + joinUniqueNames(implementationNames); } private static @NotNull List getImplementationNames(@NotNull List statements) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java index ba6d3996b413..f2a159709562 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifySuperArgumentFix.java @@ -3,7 +3,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.intention.CommonIntentionAction; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.refactoring.util.RefactoringChangeUtil; @@ -19,7 +19,7 @@ public class QualifySuperArgumentFix extends QualifyThisOrSuperArgumentFix { @Override protected String getQualifierText() { - return PsiKeywords.SUPER; + return JavaKeywords.SUPER; } @Override diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java index 771bfdb7e424..b8ca26b1d661 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/QualifyThisArgumentFix.java @@ -3,7 +3,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.intention.CommonIntentionAction; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.infos.CandidateInfo; import com.intellij.psi.util.PsiTreeUtil; @@ -23,7 +23,7 @@ public class QualifyThisArgumentFix extends QualifyThisOrSuperArgumentFix{ @Override protected String getQualifierText() { - return PsiKeywords.THIS; + return JavaKeywords.THIS; } @Override diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceGetClassWithClassLiteralFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceGetClassWithClassLiteralFix.java index 8f5bbef926bb..f32b15d022e5 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceGetClassWithClassLiteralFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceGetClassWithClassLiteralFix.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.intention.CommonIntentionAction; import com.intellij.codeInsight.intention.PriorityAction; import com.intellij.codeInspection.CommonQuickFixBundle; import com.intellij.java.analysis.JavaAnalysisBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -39,7 +39,7 @@ public class ReplaceGetClassWithClassLiteralFix extends PsiUpdateModCommandActio if (aClass == null) return null; String className = aClass.getName(); if (className == null) return null; - return Presentation.of(CommonQuickFixBundle.message("fix.replace.with.x", className + "." + PsiKeywords.CLASS)).withPriority( + return Presentation.of(CommonQuickFixBundle.message("fix.replace.with.x", className + "." + JavaKeywords.CLASS)).withPriority( PriorityAction.Priority.HIGH); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithYieldFix.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithYieldFix.java index 59d011e98896..3d1aa188c415 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithYieldFix.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ReplaceWithYieldFix.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -28,7 +28,7 @@ public class ReplaceWithYieldFix extends PsiUpdateModCommandAction PsiKeywords.VAR + " " + p.getName()).joining(",", "(", ")"); + String newListText = StreamEx.of(parameters).map(p -> JavaKeywords.VAR + " " + p.getName()).joining(",", "(", ")"); newList = ((PsiLambdaExpression)JavaPsiFacade.getElementFactory(list.getProject()) .createExpressionFromText(newListText+" -> {}", null)).getParameterList(); newList = (PsiParameterList)new CommentTracker().replaceAndRestoreComments(list, newList); diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/intention/impl/SplitConditionUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/impl/SplitConditionUtil.java index bee9212e6440..7f8a38d786f4 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInsight/intention/impl/SplitConditionUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInsight/intention/impl/SplitConditionUtil.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.intention.impl; import com.intellij.codeInsight.PsiEquivalenceUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; @@ -166,7 +166,7 @@ public final class SplitConditionUtil { } } else { - thenString = "{" + createIfString(leave, thenBranch, String.join("\n" + PsiKeywords.ELSE + " ", elseChain), tracker) + "\n}"; + thenString = "{" + createIfString(leave, thenBranch, String.join("\n" + JavaKeywords.ELSE + " ", elseChain), tracker) + "\n}"; } String ifString = createIfString(extract, thenString, elseBranch, tracker); return (PsiIfStatement)factory.createStatementFromText(ifString, thenBranch); @@ -213,8 +213,8 @@ public final class SplitConditionUtil { private static @NotNull String createIfString(@NotNull String condition, @NotNull String thenBranch, @Nullable String elseBranch) { - final String elsePart = elseBranch != null ? "\n " + PsiKeywords.ELSE + " " + elseBranch : ""; - return PsiKeywords.IF + " (" + condition + ")\n" + thenBranch + elsePart; + final String elsePart = elseBranch != null ? "\n " + JavaKeywords.ELSE + " " + elseBranch : ""; + return JavaKeywords.IF + " (" + condition + ")\n" + thenBranch + elsePart; } private static @NotNull String toThenBranchString(@NotNull PsiStatement statement) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/java/JavaDfaValueFactory.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/java/JavaDfaValueFactory.java index bd6a046d9634..45f6a0cde880 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/java/JavaDfaValueFactory.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/java/JavaDfaValueFactory.java @@ -17,7 +17,7 @@ import com.intellij.codeInspection.dataFlow.value.DfaTypeValue; import com.intellij.codeInspection.dataFlow.value.DfaValue; import com.intellij.codeInspection.dataFlow.value.DfaValueFactory; import com.intellij.codeInspection.dataFlow.value.VariableDescriptor; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.impl.JavaConstantExpressionEvaluator; import com.intellij.psi.impl.source.PsiFieldImpl; @@ -292,7 +292,7 @@ public final class JavaDfaValueFactory { } PsiExpression initializer = PsiFieldImpl.getDetachedInitializer(variable); initializer = PsiUtil.skipParenthesizedExprDown(initializer); - if (initializer instanceof PsiLiteralExpression && initializer.textMatches(PsiKeywords.NULL)) { + if (initializer instanceof PsiLiteralExpression && initializer.textMatches(JavaKeywords.NULL)) { return factory.fromDfType(DfTypes.NULL); } if (variable instanceof PsiField && variable.hasModifierProperty(PsiModifier.STATIC) && ExpressionUtils.isNewObject(initializer)) { diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/jvm/FieldChecker.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/jvm/FieldChecker.java index fc62a42a06d8..8575097301be 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/jvm/FieldChecker.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/jvm/FieldChecker.java @@ -2,7 +2,7 @@ package com.intellij.codeInspection.dataFlow.jvm; import com.intellij.codeInspection.dataFlow.JavaMethodContractUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.java.JavaLanguage; import com.intellij.psi.*; import com.intellij.psi.util.CachedValuesManager; @@ -109,7 +109,7 @@ public class FieldChecker { for (PsiMethodCallExpression call : SyntaxTraverser.psiTraverser().withRoot(body).filter(PsiMethodCallExpression.class)) { PsiReferenceExpression methodExpression = call.getMethodExpression(); - if (methodExpression.textMatches(PsiKeywords.THIS) || methodExpression.textMatches(PsiKeywords.SUPER)) continue; + if (methodExpression.textMatches(JavaKeywords.THIS) || methodExpression.textMatches(JavaKeywords.SUPER)) continue; if (SAFE_CALLS.test(call)) continue; if (!virtual) return true; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfIntRangeType.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfIntRangeType.java index 918b3e2fc02b..3671868ea4aa 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfIntRangeType.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfIntRangeType.java @@ -3,7 +3,7 @@ package com.intellij.codeInspection.dataFlow.types; import com.intellij.codeInspection.dataFlow.jvm.JvmPsiRangeSetUtil; import com.intellij.codeInspection.dataFlow.rangeSet.LongRangeSet; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.PsiTypes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,7 +26,7 @@ final class DfIntRangeType extends DfAbstractRangeType implements DfIntType { @Override public @NotNull String toString() { - if (getRange() == FULL_RANGE) return PsiKeywords.INT; - return PsiKeywords.INT + " " + JvmPsiRangeSetUtil.getPresentationText(getRange(), PsiTypes.intType()); + if (getRange() == FULL_RANGE) return JavaKeywords.INT; + return JavaKeywords.INT + " " + JvmPsiRangeSetUtil.getPresentationText(getRange(), PsiTypes.intType()); } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfLongRangeType.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfLongRangeType.java index 11e5d8220b29..32d80b26474f 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfLongRangeType.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfLongRangeType.java @@ -3,7 +3,7 @@ package com.intellij.codeInspection.dataFlow.types; import com.intellij.codeInspection.dataFlow.jvm.JvmPsiRangeSetUtil; import com.intellij.codeInspection.dataFlow.rangeSet.LongRangeSet; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.PsiTypes; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -15,7 +15,7 @@ final class DfLongRangeType extends DfAbstractRangeType implements DfLongType { @Override public @NotNull String toString() { - if (getRange() == LongRangeSet.all()) return PsiKeywords.LONG; - return PsiKeywords.LONG + " " + JvmPsiRangeSetUtil.getPresentationText(getRange(), PsiTypes.longType()); + if (getRange() == LongRangeSet.all()) return JavaKeywords.LONG; + return JavaKeywords.LONG + " " + JvmPsiRangeSetUtil.getPresentationText(getRange(), PsiTypes.longType()); } } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfTypes.java b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfTypes.java index 0b4dc4260c34..3e2861e19ab8 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfTypes.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/dataFlow/types/DfTypes.java @@ -10,7 +10,7 @@ import com.intellij.codeInspection.dataFlow.jvm.JvmPsiRangeSetUtil; import com.intellij.codeInspection.dataFlow.jvm.SpecialField; import com.intellij.codeInspection.dataFlow.rangeSet.LongRangeSet; import com.intellij.codeInspection.dataFlow.rangeSet.LongRangeType; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.PsiPrimitiveType; import com.intellij.psi.PsiType; import com.intellij.psi.PsiTypes; @@ -65,7 +65,7 @@ public final class DfTypes { @Override public @NotNull String toString() { - return PsiKeywords.BOOLEAN; + return JavaKeywords.BOOLEAN; } }; diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefSerializationUtil.java b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefSerializationUtil.java index f782bf80db56..1a6c188c46c5 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefSerializationUtil.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deadCode/RefSerializationUtil.java @@ -2,7 +2,7 @@ package com.intellij.codeInspection.deadCode; import com.intellij.codeInspection.reference.RefClass; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.psi.*; @@ -67,7 +67,7 @@ public final class RefSerializationUtil { List parameters = method.getUastParameters(); if (parameters.size() != 1) return false; if (!equalsToText(parameters.get(0).getType(), "java.io.ObjectInputStream")) return false; - if (!equalsToText(method.getReturnType(), PsiKeywords.VOID)) return false; + if (!equalsToText(method.getReturnType(), JavaKeywords.VOID)) return false; UClass aClass = UDeclarationKt.getContainingDeclaration(method, UClass.class); return aClass == null || isSerializable(aClass, refClass); } @@ -76,7 +76,7 @@ public final class RefSerializationUtil { if (!"readObjectNoData".equals(method.getName())) return false; if (method.isStatic() || method.getVisibility() != UastVisibility.PRIVATE) return false; if (!method.getUastParameters().isEmpty()) return false; - if (!equalsToText(method.getReturnType(), PsiKeywords.VOID)) return false; + if (!equalsToText(method.getReturnType(), JavaKeywords.VOID)) return false; UClass aClass = UDeclarationKt.getContainingDeclaration(method, UClass.class); return aClass == null || isSerializable(aClass, refClass); } diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/RedundantScheduledForRemovalAnnotationInspection.kt b/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/RedundantScheduledForRemovalAnnotationInspection.kt index 1079a9f26b08..7ee10650984d 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/RedundantScheduledForRemovalAnnotationInspection.kt +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/deprecation/RedundantScheduledForRemovalAnnotationInspection.kt @@ -5,7 +5,7 @@ import com.intellij.codeInspection.LocalInspectionTool import com.intellij.codeInspection.ProblemsHolder import com.intellij.codeInspection.RemoveAnnotationQuickFix import com.intellij.java.analysis.JavaAnalysisBundle -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.lang.jvm.annotation.JvmAnnotationConstantValue import com.intellij.modcommand.ModPsiUpdater import com.intellij.modcommand.PsiUpdateModCommandQuickFix @@ -55,7 +55,7 @@ class RedundantScheduledForRemovalAnnotationInspection : LocalInspectionTool() { val deprecatedAnnotation = forRemovalAnnotation.owner?.findAnnotation(CommonClassNames.JAVA_LANG_DEPRECATED) ?: return val javaFile = forRemovalAnnotation.containingFile as? PsiJavaFile forRemovalAnnotation.delete() - val trueLiteral = JavaPsiFacade.getElementFactory(project).createExpressionFromText(PsiKeywords.TRUE, null) + val trueLiteral = JavaPsiFacade.getElementFactory(project).createExpressionFromText(JavaKeywords.TRUE, null) deprecatedAnnotation.setDeclaredAttributeValue("forRemoval", trueLiteral) if (javaFile != null) { JavaCodeStyleManager.getInstance(project).removeRedundantImports(javaFile) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/Java9RedundantRequiresStatementInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/Java9RedundantRequiresStatementInspection.java index e1cc9cda41f1..7b848c34c01a 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/Java9RedundantRequiresStatementInspection.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/Java9RedundantRequiresStatementInspection.java @@ -8,7 +8,7 @@ import com.intellij.codeInspection.reference.*; import com.intellij.concurrency.ConcurrentCollectionFactory; import com.intellij.java.analysis.JavaAnalysisBundle; import com.intellij.java.codeserver.core.JavaPsiModuleUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.module.LanguageLevelUtil; @@ -183,7 +183,7 @@ public final class Java9RedundantRequiresStatementInspection extends GlobalJavaB if (parent instanceof PsiJavaModule currentModule) { PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(currentModule.getProject()).getParserFacade(); for (String dependencyName : myDependencies) { - PsiStatement requiresStatement = parserFacade.createModuleStatementFromText(PsiKeywords.REQUIRES + ' ' + dependencyName, null); + PsiStatement requiresStatement = parserFacade.createModuleStatementFromText(JavaKeywords.REQUIRES + ' ' + dependencyName, null); currentModule.addAfter(requiresStatement, statementToDelete); } } diff --git a/java/java-analysis-impl/src/com/intellij/psi/impl/search/JavaNullMethodArgumentUtil.java b/java/java-analysis-impl/src/com/intellij/psi/impl/search/JavaNullMethodArgumentUtil.java index b61fc14005de..f0e13acd0513 100644 --- a/java/java-analysis-impl/src/com/intellij/psi/impl/search/JavaNullMethodArgumentUtil.java +++ b/java/java-analysis-impl/src/com/intellij/psi/impl/search/JavaNullMethodArgumentUtil.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.search; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -74,7 +74,7 @@ public final class JavaNullMethodArgumentUtil { MethodReferencesSearch.search(method, scope, true).forEach(ref -> { PsiExpressionList argumentList = getCallArgumentList(ref.getElement()); PsiExpression argument = getCallArgument(argumentList, argumentIdx); - if (argument instanceof PsiLiteralExpression && argument.textMatches(PsiKeywords.NULL)) { + if (argument instanceof PsiLiteralExpression && argument.textMatches(JavaKeywords.NULL)) { if (argumentList.getParent() instanceof PsiMethodCallExpression methodCall) { PsiMethod target = methodCall.resolveMethod(); // Could be resolved to overriding method diff --git a/java/java-analysis-impl/src/com/intellij/psi/impl/search/ThrowSearchUtil.java b/java/java-analysis-impl/src/com/intellij/psi/impl/search/ThrowSearchUtil.java index 4a0137aa96ca..72c5a3b06150 100644 --- a/java/java-analysis-impl/src/com/intellij/psi/impl/search/ThrowSearchUtil.java +++ b/java/java-analysis-impl/src/com/intellij/psi/impl/search/ThrowSearchUtil.java @@ -2,7 +2,7 @@ package com.intellij.psi.impl.search; import com.intellij.find.findUsages.FindUsagesOptions; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.NlsSafe; import com.intellij.psi.*; @@ -118,7 +118,7 @@ public final class ThrowSearchUtil { return new Root[]{new Root(aThrow.getParent(), exType, isExactExnType(exn))}; } - if (element instanceof PsiKeyword kwd && PsiKeywords.THROWS.equals(kwd.getText())) { + if (element instanceof PsiKeyword kwd && JavaKeywords.THROWS.equals(kwd.getText())) { final PsiElement parent = kwd.getParent(); if (parent != null && parent.getParent() instanceof PsiMethod method) { final PsiReferenceList throwsList = method.getThrowsList(); @@ -143,7 +143,7 @@ public final class ThrowSearchUtil { final PsiType type = aThrow.getException().getType(); return PsiFormatUtil.formatType(type, PsiFormatUtilBase.SHOW_FQ_CLASS_NAMES, PsiSubstitutor.EMPTY); } - if (e instanceof PsiKeyword && PsiKeywords.THROWS.equals(e.getText())) { + if (e instanceof PsiKeyword && JavaKeywords.THROWS.equals(e.getText())) { return e.getParent().getText(); } LOG.error("invalid searchable element"); diff --git a/java/java-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionReferenceUtil.java b/java/java-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionReferenceUtil.java index 1b758d832634..9f481ed826f0 100644 --- a/java/java-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionReferenceUtil.java +++ b/java/java-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/JavaReflectionReferenceUtil.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.codeInsight.completion.PrioritizedLookupElement; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Iconable; import com.intellij.openapi.util.Pair; @@ -767,7 +767,7 @@ public final class JavaReflectionReferenceUtil { public static final class ReflectiveSignature implements Comparable { public static final ReflectiveSignature NO_ARGUMENT_CONSTRUCTOR_SIGNATURE = - new ReflectiveSignature(null, PsiKeywords.VOID, ArrayUtilRt.EMPTY_STRING_ARRAY); + new ReflectiveSignature(null, JavaKeywords.VOID, ArrayUtilRt.EMPTY_STRING_ARRAY); private final Icon myIcon; private final @NotNull String myReturnType; diff --git a/java/java-analysis-impl/src/com/siyeh/ig/assignment/AssignmentToNullInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/assignment/AssignmentToNullInspection.java index b21bcdcba39f..7378b13ce89d 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/assignment/AssignmentToNullInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/assignment/AssignmentToNullInspection.java @@ -19,7 +19,7 @@ import com.intellij.codeInsight.NullableNotNullManager; import com.intellij.codeInsight.intention.AddAnnotationModCommandAction; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.options.OptPane; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.util.PsiUtil; import com.siyeh.InspectionGadgetsBundle; @@ -84,7 +84,7 @@ public final class AssignmentToNullInspection extends BaseInspection { @NotNull PsiLiteralExpression value) { super.visitLiteralExpression(value); final String text = value.getText(); - if (!PsiKeywords.NULL.equals(text)) { + if (!JavaKeywords.NULL.equals(text)) { return; } PsiElement parent = value.getParent(); diff --git a/java/java-analysis-impl/src/com/siyeh/ig/assignment/IncrementDecrementUsedAsExpressionInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/assignment/IncrementDecrementUsedAsExpressionInspection.java index 2f5a061c89f3..82217394b110 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/assignment/IncrementDecrementUsedAsExpressionInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/assignment/IncrementDecrementUsedAsExpressionInspection.java @@ -17,7 +17,7 @@ package com.siyeh.ig.assignment; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -177,11 +177,11 @@ public final class IncrementDecrementUsedAsExpressionInspection extends BaseInsp parent.addBefore(newStatement, statement); final String keyword; if (statement instanceof PsiReturnStatement) { - keyword = PsiKeywords.RETURN; + keyword = JavaKeywords.RETURN; } else if (statement instanceof PsiYieldStatement) { - keyword = PsiKeywords.YIELD; + keyword = JavaKeywords.YIELD; } else { - keyword = PsiKeywords.THROW; + keyword = JavaKeywords.THROW; } final PsiStatement newReturnStatement = factory.createStatementFromText(keyword + " " + variableName + ';', statement); statement.replace(newReturnStatement); diff --git a/java/java-analysis-impl/src/com/siyeh/ig/classlayout/ClassMayBeInterfaceInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/classlayout/ClassMayBeInterfaceInspection.java index 4cffe0ac5215..4d88f695ab1d 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/classlayout/ClassMayBeInterfaceInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/classlayout/ClassMayBeInterfaceInspection.java @@ -18,7 +18,7 @@ package com.siyeh.ig.classlayout; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.options.OptPane; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModCommand; import com.intellij.modcommand.ModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -128,7 +128,7 @@ public final class ClassMayBeInterfaceInspection extends BaseInspection { } final PsiKeyword classKeyword = PsiTreeUtil.getPrevSiblingOfType(nameIdentifier, PsiKeyword.class); final PsiElementFactory factory = JavaPsiFacade.getElementFactory(aClass.getProject()); - final PsiKeyword interfaceKeyword = factory.createKeyword(PsiKeywords.INTERFACE); + final PsiKeyword interfaceKeyword = factory.createKeyword(JavaKeywords.INTERFACE); if (classKeyword == null) { return; } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java index 24b7c44b6e19..4ea9e0df595d 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/classlayout/UtilityClassCanBeEnumInspection.java @@ -3,7 +3,7 @@ package com.siyeh.ig.classlayout; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -71,7 +71,7 @@ public final class UtilityClassCanBeEnumInspection extends BaseInspection implem final PsiStatement statement = factory.createStatementFromText(";", element); final PsiElement token = statement.getChildren()[0]; aClass.addAfter(token, aClass.getLBrace()); - final PsiKeyword newKeyword = factory.createKeyword(PsiKeywords.ENUM); + final PsiKeyword newKeyword = factory.createKeyword(JavaKeywords.ENUM); keywords.get(0).replace(newKeyword); } } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java index 03966a90c03d..9990838799d8 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/controlflow/FallthruInSwitchStatementInspection.java @@ -17,7 +17,7 @@ package com.siyeh.ig.controlflow; import com.intellij.codeInspection.JavaSuppressionUtil; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -65,7 +65,7 @@ public final class FallthruInSwitchStatementInspection extends BaseInspection { @Override public @NotNull String getFamilyName() { - return InspectionGadgetsBundle.message("fallthru.in.switch.statement.quickfix", PsiKeywords.BREAK); + return InspectionGadgetsBundle.message("fallthru.in.switch.statement.quickfix", JavaKeywords.BREAK); } @Override @@ -132,7 +132,7 @@ public final class FallthruInSwitchStatementInspection extends BaseInspection { continue; } if (ControlFlowUtils.statementMayCompleteNormally(previousStatement)) { - registerError(statement, switchBlock instanceof PsiSwitchStatement || isOnTheFly(), switchBlock instanceof PsiSwitchExpression ? PsiKeywords.YIELD : PsiKeywords.BREAK); + registerError(statement, switchBlock instanceof PsiSwitchStatement || isOnTheFly(), switchBlock instanceof PsiSwitchExpression ? JavaKeywords.YIELD : JavaKeywords.BREAK); } } } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/controlflow/ForLoopReplaceableByWhileInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/controlflow/ForLoopReplaceableByWhileInspection.java index 726a0567bca6..1e91e821c1ea 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/controlflow/ForLoopReplaceableByWhileInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/controlflow/ForLoopReplaceableByWhileInspection.java @@ -21,7 +21,7 @@ import com.intellij.codeInspection.CommonQuickFixBundle; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemHighlightType; import com.intellij.codeInspection.options.OptPane; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -80,7 +80,7 @@ public final class ForLoopReplaceableByWhileInspection extends BaseInspection im @Override public @NotNull String getFamilyName() { - return CommonQuickFixBundle.message("fix.replace.with.x", PsiKeywords.WHILE); + return CommonQuickFixBundle.message("fix.replace.with.x", JavaKeywords.WHILE); } @Override diff --git a/java/java-analysis-impl/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java index c3a72ba0def1..682d931351ff 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/controlflow/IfStatementWithIdenticalBranchesInspection.java @@ -21,7 +21,7 @@ import com.intellij.codeInspection.options.OptPane; import com.intellij.codeInspection.util.InspectionMessage; import com.intellij.codeInspection.util.IntentionName; import com.intellij.java.analysis.JavaAnalysisBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -627,7 +627,7 @@ public final class IfStatementWithIdenticalBranchesInspection extends AbstractBa private static @Nullable ImplicitElseData getIfWithImplicitElse(@NotNull PsiIfStatement ifStatement, PsiStatement @NotNull [] thenStatements, String jumpKeyword, boolean basicJumpStatement) { - if (!PsiKeywords.RETURN.equals(jumpKeyword) && !PsiKeywords.CONTINUE.equals(jumpKeyword)) return null; + if (!JavaKeywords.RETURN.equals(jumpKeyword) && !JavaKeywords.CONTINUE.equals(jumpKeyword)) return null; int statementsLength = thenStatements.length; if (statementsLength == 0) return null; PsiIfStatement currentIf = ifStatement; @@ -659,13 +659,13 @@ public final class IfStatementWithIdenticalBranchesInspection extends AbstractBa // ensure it is last statements in method PsiElement parent = currentIf.getParent(); if (!(parent instanceof PsiCodeBlock)) return null; - if (PsiKeywords.RETURN.equals(jumpKeyword)) { + if (JavaKeywords.RETURN.equals(jumpKeyword)) { if (!(parent.getParent() instanceof PsiMethod)) return null; if (!statements.isEmpty()) { if (PsiTreeUtil.getNextSiblingOfType(statements.get(statements.size() - 1), PsiStatement.class) != null) return null; } } - if (PsiKeywords.CONTINUE.equals(jumpKeyword) && !(parent.getParent() instanceof PsiBlockStatement) && !(parent.getParent().getParent() instanceof PsiLoopStatement)) return null; + if (JavaKeywords.CONTINUE.equals(jumpKeyword) && !(parent.getParent() instanceof PsiBlockStatement) && !(parent.getParent().getParent() instanceof PsiLoopStatement)) return null; if (basicJumpStatement) { // skip possible jump statement if (count == statementsLength || count == statementsLength - 1) return new ImplicitElseData(statements, currentIf); @@ -716,10 +716,10 @@ public final class IfStatementWithIdenticalBranchesInspection extends AbstractBa String jumpKeyword = null; boolean basicJumpStatement = false; if (lastThenStatement instanceof PsiReturnStatement) { - jumpKeyword = PsiKeywords.RETURN; + jumpKeyword = JavaKeywords.RETURN; basicJumpStatement = ((PsiReturnStatement)lastThenStatement).getReturnValue() == null; } else if (lastThenStatement instanceof PsiContinueStatement) { - jumpKeyword = PsiKeywords.CONTINUE; + jumpKeyword = JavaKeywords.CONTINUE; basicJumpStatement = ((PsiContinueStatement)lastThenStatement).getLabelIdentifier() == null; } if (jumpKeyword == null) return null; diff --git a/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/EmptyFinallyBlockInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/EmptyFinallyBlockInspection.java index 0fe8673c7fb2..28f96bbfae8d 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/EmptyFinallyBlockInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/EmptyFinallyBlockInspection.java @@ -18,7 +18,7 @@ package com.siyeh.ig.errorhandling; import com.intellij.codeInsight.BlockUtils; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -146,7 +146,7 @@ public final class EmptyFinallyBlockInspection extends BaseInspection implements final PsiElement[] children = statement.getChildren(); for (final PsiElement child : children) { final String childText = child.getText(); - if (PsiKeywords.FINALLY.equals(childText)) { + if (JavaKeywords.FINALLY.equals(childText)) { final boolean canDeleteTry = statement.getCatchBlocks().length == 0 && statement.getResourceList() == null; registerError(child, Boolean.valueOf(canDeleteTry)); return; diff --git a/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/FinallyBlockCannotCompleteNormallyInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/FinallyBlockCannotCompleteNormallyInspection.java index 1160a9f50dad..efa2be53eaed 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/FinallyBlockCannotCompleteNormallyInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/errorhandling/FinallyBlockCannotCompleteNormallyInspection.java @@ -15,7 +15,7 @@ */ package com.siyeh.ig.errorhandling; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.siyeh.InspectionGadgetsBundle; @@ -67,7 +67,7 @@ public final class FinallyBlockCannotCompleteNormallyInspection final PsiElement[] children = statement.getChildren(); for (final PsiElement child : children) { final String childText = child.getText(); - if (PsiKeywords.FINALLY.equals(childText)) { + if (JavaKeywords.FINALLY.equals(childText)) { registerError(child); return; } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/internationalization/CharacterComparisonInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/internationalization/CharacterComparisonInspection.java index 9ff89172ff9e..22d7bd465a44 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/internationalization/CharacterComparisonInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/internationalization/CharacterComparisonInspection.java @@ -15,7 +15,7 @@ */ package com.siyeh.ig.internationalization; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.CommonClassNames; import com.intellij.psi.PsiBinaryExpression; import com.intellij.psi.PsiExpression; @@ -64,7 +64,7 @@ public final class CharacterComparisonInspection extends BaseInspection { } private static boolean isCharacter(@Nullable PsiExpression expression) { - return ExpressionUtils.hasType(expression, PsiKeywords.CHAR) || + return ExpressionUtils.hasType(expression, JavaKeywords.CHAR) || ExpressionUtils.hasType(expression, CommonClassNames.JAVA_LANG_CHARACTER); } } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/performance/BooleanConstructorInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/performance/BooleanConstructorInspection.java index bf2f4ad57d22..5596e857a5b8 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/performance/BooleanConstructorInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/performance/BooleanConstructorInspection.java @@ -17,7 +17,7 @@ package com.siyeh.ig.performance; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -63,8 +63,8 @@ public final class BooleanConstructorInspection extends BaseInspection implement private static class BooleanConstructorFix extends PsiUpdateModCommandQuickFix { - private static final String TRUE = '\"' + PsiKeywords.TRUE + '\"'; - private static final String FALSE = '\"' + PsiKeywords.FALSE + '\"'; + private static final String TRUE = '\"' + JavaKeywords.TRUE + '\"'; + private static final String FALSE = '\"' + JavaKeywords.FALSE + '\"'; @Override public @NotNull String getFamilyName() { @@ -90,10 +90,10 @@ public final class BooleanConstructorInspection extends BaseInspection implement final LanguageLevel languageLevel = PsiUtil.getLanguageLevel(expression); CommentTracker tracker = new CommentTracker(); final @NonNls String newExpression; - if (PsiKeywords.TRUE.equals(text) || TRUE.equalsIgnoreCase(text)) { + if (JavaKeywords.TRUE.equals(text) || TRUE.equalsIgnoreCase(text)) { newExpression = "java.lang.Boolean.TRUE"; } - else if (PsiKeywords.FALSE.equals(text) || FALSE.equalsIgnoreCase(text)) { + else if (JavaKeywords.FALSE.equals(text) || FALSE.equalsIgnoreCase(text)) { newExpression = "java.lang.Boolean.FALSE"; } else if (languageLevel.equals(LanguageLevel.JDK_1_3)) { diff --git a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/BoolUtils.java b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/BoolUtils.java index f7a2ce3ac720..4dd5b59f92ea 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/BoolUtils.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/BoolUtils.java @@ -17,7 +17,7 @@ package com.siyeh.ig.psiutils; import com.intellij.codeInspection.dataFlow.DfaPsiUtil; import com.intellij.codeInspection.dataFlow.value.RelationType; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.text.StringUtil; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; @@ -280,7 +280,7 @@ public final class BoolUtils { return false; } final @NonNls String text = literalExpression.getText(); - return PsiKeywords.TRUE.equals(text) || PsiKeywords.FALSE.equals(text); + return JavaKeywords.TRUE.equals(text) || JavaKeywords.FALSE.equals(text); } @Contract(value = "null -> false", pure = true) @@ -289,7 +289,7 @@ public final class BoolUtils { if (expression == null) { return false; } - return PsiKeywords.TRUE.equals(expression.getText()); + return JavaKeywords.TRUE.equals(expression.getText()); } @Contract(value = "null -> false", pure = true) @@ -298,7 +298,7 @@ public final class BoolUtils { if (expression == null) { return false; } - return PsiKeywords.FALSE.equals(expression.getText()); + return JavaKeywords.FALSE.equals(expression.getText()); } /** diff --git a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/CodeBlockSurrounder.java b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/CodeBlockSurrounder.java index 8d8b76c0d92f..2b70a5313ab6 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/CodeBlockSurrounder.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/CodeBlockSurrounder.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.intention.impl.SplitConditionUtil; import com.intellij.codeInspection.ConditionalBreakInInfiniteLoopInspection; import com.intellij.codeInspection.RedundantLambdaCodeBlockInspection; import com.intellij.codeInspection.dataFlow.DfaPsiUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.*; @@ -671,7 +671,7 @@ public abstract class CodeBlockSurrounder { PsiCodeBlock copyFinally = copy.getFinallyBlock(); if (copyFinally != null) { PsiElement element = PsiTreeUtil.skipWhitespacesAndCommentsBackward(copyFinally); - if (element != null && element.textMatches(PsiKeywords.FINALLY)) { + if (element != null && element.textMatches(JavaKeywords.FINALLY)) { element.delete(); } copyFinally.delete(); diff --git a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/ExpressionUtils.java b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/ExpressionUtils.java index 1333280f37e4..341fd172e2f9 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/ExpressionUtils.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/ExpressionUtils.java @@ -8,7 +8,7 @@ import com.intellij.codeInspection.dataFlow.JavaMethodContractUtil; import com.intellij.codeInspection.dataFlow.MutationSignature; import com.intellij.java.codeserver.core.JavaPsiReferenceUtil; import com.intellij.java.codeserver.core.JavaPsiReferenceUtil.ForwardReferenceProblem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; @@ -307,7 +307,7 @@ public final class ExpressionUtils { if (ignoreNegatedNullComparison) { final String lhsText = lhs.getText(); final String rhsText = rhs.getText(); - if (PsiKeywords.NULL.equals(lhsText) || PsiKeywords.NULL.equals(rhsText)) { + if (JavaKeywords.NULL.equals(lhsText) || JavaKeywords.NULL.equals(rhsText)) { return false; } } @@ -919,11 +919,11 @@ public final class ExpressionUtils { return null; } } - return factory.createExpressionFromText(thisQualifier + "." + PsiKeywords.THIS, ref); + return factory.createExpressionFromText(thisQualifier + "." + JavaKeywords.THIS, ref); } } } - return factory.createExpressionFromText(PsiKeywords.THIS, ref); + return factory.createExpressionFromText(JavaKeywords.THIS, ref); } private static boolean isStaticMember(@Nullable PsiMember member) { diff --git a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/MethodUtils.java b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/MethodUtils.java index b3d02d467655..c6da7246aa01 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/MethodUtils.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/MethodUtils.java @@ -2,7 +2,7 @@ package com.siyeh.ig.psiutils; import com.intellij.codeInsight.AnnotationUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.java.JavaLanguage; import com.intellij.lang.jvm.JvmModifier; import com.intellij.openapi.progress.ProgressManager; @@ -386,7 +386,7 @@ public final class MethodUtils { } else if (expression instanceof UCallExpression) { final String methodName = ((UCallExpression)expression).getMethodName(); - if (methodName != null && !methodName.equals(PsiKeywords.SUPER) && !methodName.equals("")) return false; + if (methodName != null && !methodName.equals(JavaKeywords.SUPER) && !methodName.equals("")) return false; } else return false; } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/TypeUtils.java b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/TypeUtils.java index f19346a90793..6aeca8fb1ddc 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/psiutils/TypeUtils.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/psiutils/TypeUtils.java @@ -16,7 +16,7 @@ package com.siyeh.ig.psiutils; import com.intellij.codeInspection.util.OptionalUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; @@ -321,11 +321,11 @@ public final class TypeUtils { return "(byte)0"; } else if (PsiTypes.booleanType().equals(type)) { - return PsiKeywords.FALSE; + return JavaKeywords.FALSE; } else if (PsiTypes.charType().equals(type)) { return "'\0'"; } - return PsiKeywords.NULL; + return JavaKeywords.NULL; } } \ No newline at end of file diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/ControlFlowStatementVisitorBase.java b/java/java-analysis-impl/src/com/siyeh/ig/style/ControlFlowStatementVisitorBase.java index 9056b20603b2..eb4fc42d14c6 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/ControlFlowStatementVisitorBase.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/ControlFlowStatementVisitorBase.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.siyeh.ig.style; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.Pair; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; @@ -17,7 +17,7 @@ public abstract class ControlFlowStatementVisitorBase extends BaseInspectionVisi super.visitForeachStatement(statement); final PsiStatement body = statement.getBody(); if (isApplicable(body)) { - registerLoopStatementErrors(statement, body, PsiKeywords.FOR); + registerLoopStatementErrors(statement, body, JavaKeywords.FOR); } } @@ -26,7 +26,7 @@ public abstract class ControlFlowStatementVisitorBase extends BaseInspectionVisi super.visitForStatement(statement); final PsiStatement body = statement.getBody(); if (isApplicable(body)) { - registerLoopStatementErrors(statement, body, PsiKeywords.FOR); + registerLoopStatementErrors(statement, body, JavaKeywords.FOR); } } @@ -36,7 +36,7 @@ public abstract class ControlFlowStatementVisitorBase extends BaseInspectionVisi super.visitWhileStatement(statement); final PsiStatement body = statement.getBody(); if (isApplicable(body)) { - registerLoopStatementErrors(statement, body, PsiKeywords.WHILE); + registerLoopStatementErrors(statement, body, JavaKeywords.WHILE); } } @@ -45,7 +45,7 @@ public abstract class ControlFlowStatementVisitorBase extends BaseInspectionVisi super.visitDoWhileStatement(statement); final PsiStatement body = statement.getBody(); if (isApplicable(body)) { - registerLoopStatementErrors(statement, body, PsiKeywords.DO); + registerLoopStatementErrors(statement, body, JavaKeywords.DO); } } @@ -54,11 +54,11 @@ public abstract class ControlFlowStatementVisitorBase extends BaseInspectionVisi super.visitIfStatement(statement); final PsiStatement thenBranch = statement.getThenBranch(); if (isApplicable(thenBranch)) { - registerControlFlowStatementErrors(statement.getFirstChild(), thenBranch.getLastChild(), thenBranch, PsiKeywords.IF); + registerControlFlowStatementErrors(statement.getFirstChild(), thenBranch.getLastChild(), thenBranch, JavaKeywords.IF); } final PsiStatement elseBranch = statement.getElseBranch(); if (isApplicable(elseBranch)) { - registerControlFlowStatementErrors(statement.getElseElement(), elseBranch.getLastChild(), elseBranch, PsiKeywords.ELSE); + registerControlFlowStatementErrors(statement.getElseElement(), elseBranch.getLastChild(), elseBranch, JavaKeywords.ELSE); } } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticUsageInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticUsageInspection.java index eefd12673387..c44fd9a92726 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticUsageInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticUsageInspection.java @@ -18,7 +18,7 @@ package com.siyeh.ig.style; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.options.OptPane; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -137,7 +137,7 @@ public final class UnnecessarilyQualifiedStaticUsageInspection extends BaseInspe if (referenceName == null) { return false; } - if (referenceName.equals(PsiKeywords.YIELD) && parent instanceof PsiMethodCallExpression) { + if (referenceName.equals(JavaKeywords.YIELD) && parent instanceof PsiMethodCallExpression) { // Qualifier required since Java 14 (JLS 3.8) return false; } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticallyImportedElementInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticallyImportedElementInspection.java index 7f29b058878f..da75f02eab80 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticallyImportedElementInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarilyQualifiedStaticallyImportedElementInspection.java @@ -3,7 +3,7 @@ package com.siyeh.ig.style; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -57,7 +57,7 @@ public final class UnnecessarilyQualifiedStaticallyImportedElementInspection ext @Override public void visitReferenceElement(@NotNull PsiJavaCodeReferenceElement reference) { super.visitReferenceElement(reference); - if (PsiKeywords.YIELD.equals(reference.getReferenceName()) && reference.getParent() instanceof PsiMethodCallExpression) { + if (JavaKeywords.YIELD.equals(reference.getReferenceName()) && reference.getParent() instanceof PsiMethodCallExpression) { // Qualifier might be required since Java 14, so don't warn return; } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryConstructorInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryConstructorInspection.java index b63daa59d401..9c1764bb0ebf 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryConstructorInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryConstructorInspection.java @@ -17,7 +17,7 @@ package com.siyeh.ig.style; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.options.OptPane; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -135,7 +135,7 @@ public final class UnnecessaryConstructorInspection extends BaseInspection { return false; } final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression(); - return PsiKeywords.SUPER.equals(methodExpression.getReferenceName()); + return JavaKeywords.SUPER.equals(methodExpression.getReferenceName()); } } } \ No newline at end of file diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryQualifierForThisInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryQualifierForThisInspection.java index 6fd49e222f17..da03bcc8e0b3 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryQualifierForThisInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryQualifierForThisInspection.java @@ -17,7 +17,7 @@ package com.siyeh.ig.style; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -62,10 +62,10 @@ public final class UnnecessaryQualifierForThisInspection extends BaseInspection final PsiElement parent = qualifier.getParent(); CommentTracker tracker = new CommentTracker(); if (parent instanceof PsiThisExpression) { - PsiReplacementUtil.replaceExpression((PsiThisExpression)parent, PsiKeywords.THIS, tracker); + PsiReplacementUtil.replaceExpression((PsiThisExpression)parent, JavaKeywords.THIS, tracker); } else if (parent instanceof PsiSuperExpression) { - PsiReplacementUtil.replaceExpression((PsiSuperExpression)parent, PsiKeywords.SUPER, tracker); + PsiReplacementUtil.replaceExpression((PsiSuperExpression)parent, JavaKeywords.SUPER, tracker); } } } @@ -115,7 +115,7 @@ public final class UnnecessaryQualifierForThisInspection extends BaseInspection } final PsiExpression copyQualifierExpression = copy.getQualifierExpression(); assert copyQualifierExpression != null; - PsiReplacementUtil.replaceExpression(copyQualifierExpression, PsiKeywords.SUPER); + PsiReplacementUtil.replaceExpression(copyQualifierExpression, JavaKeywords.SUPER); if (copy.resolve() == ((PsiReferenceExpression)parent).resolve()) { registerError(qualifier, expression); } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarySuperConstructorInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarySuperConstructorInspection.java index f18b4afe1693..6491943f93be 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarySuperConstructorInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessarySuperConstructorInspection.java @@ -17,7 +17,7 @@ package com.siyeh.ig.style; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -72,7 +72,7 @@ public final class UnnecessarySuperConstructorInspection extends BaseInspection public void visitMethodCallExpression(@NotNull PsiMethodCallExpression call) { super.visitMethodCallExpression(call); final PsiReferenceExpression methodExpression = call.getMethodExpression(); - if (methodExpression.isQualified() || !PsiKeywords.SUPER.equals(methodExpression.getReferenceName())) { + if (methodExpression.isQualified() || !JavaKeywords.SUPER.equals(methodExpression.getReferenceName())) { return; } if (!call.getArgumentList().isEmpty()) { diff --git a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryThisInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryThisInspection.java index a45355336339..c586bb20f3d4 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryThisInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/style/UnnecessaryThisInspection.java @@ -20,7 +20,7 @@ import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.options.OptPane; import com.intellij.java.codeserver.core.JavaPsiReferenceUtil; import com.intellij.java.codeserver.core.JavaPsiReferenceUtil.ForwardReferenceProblem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -125,7 +125,7 @@ public final class UnnecessaryThisInspection extends BaseInspection implements C } final PsiElement parent = expression.getParent(); if (qualifier == null) { - if (referenceName.equals(PsiKeywords.YIELD) && parent instanceof PsiMethodCallExpression) { + if (referenceName.equals(JavaKeywords.YIELD) && parent instanceof PsiMethodCallExpression) { // Qualifier might be required since Java 14, so don't warn return; } diff --git a/java/java-analysis-impl/src/com/siyeh/ig/testFrameworks/SimplifiableAssertionInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/testFrameworks/SimplifiableAssertionInspection.java index 060fa649f9a1..7cfab18af67b 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/testFrameworks/SimplifiableAssertionInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/testFrameworks/SimplifiableAssertionInspection.java @@ -4,7 +4,7 @@ package com.siyeh.ig.testFrameworks; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.java.library.JavaLibraryUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.module.Module; @@ -49,7 +49,7 @@ public final class SimplifiableAssertionInspection extends BaseInspection implem } private static boolean isAssertThatCouldBeFail(PsiExpression position, boolean checkTrue) { - return (checkTrue ? PsiKeywords.TRUE : PsiKeywords.FALSE).equals(position.getText()); + return (checkTrue ? JavaKeywords.TRUE : JavaKeywords.FALSE).equals(position.getText()); } private static boolean isAssertEqualsThatCouldBeAssertLiteral(AssertHint assertHint) { @@ -64,10 +64,10 @@ public final class SimplifiableAssertionInspection extends BaseInspection implem return false; } final String text = expression1.getText(); - if (PsiKeywords.NULL.equals(text)) { + if (JavaKeywords.NULL.equals(text)) { return true; } - if (!PsiKeywords.TRUE.equals(text) && !PsiKeywords.FALSE.equals(text)) { + if (!JavaKeywords.TRUE.equals(text) && !JavaKeywords.FALSE.equals(text)) { return false; } final PsiType type = expression2.getType(); diff --git a/java/java-analysis-impl/src/com/siyeh/ig/threading/EmptySynchronizedStatementInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/threading/EmptySynchronizedStatementInspection.java index 4eaba2d21712..1e0d2d76bfe6 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/threading/EmptySynchronizedStatementInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/threading/EmptySynchronizedStatementInspection.java @@ -16,7 +16,7 @@ package com.siyeh.ig.threading; import com.intellij.codeInspection.LocalQuickFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.PsiCodeBlock; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiSynchronizedStatement; @@ -39,7 +39,7 @@ public final class EmptySynchronizedStatementInspection extends BaseInspection { @Override protected @Nullable LocalQuickFix buildFix(Object... infos) { - return new DeleteUnnecessaryStatementFix(PsiKeywords.SYNCHRONIZED); + return new DeleteUnnecessaryStatementFix(JavaKeywords.SYNCHRONIZED); } @Override diff --git a/java/java-analysis-impl/src/com/siyeh/ig/threading/WaitNotifyNotInSynchronizedContextInspection.java b/java/java-analysis-impl/src/com/siyeh/ig/threading/WaitNotifyNotInSynchronizedContextInspection.java index aa68cab75e5a..e14793850395 100644 --- a/java/java-analysis-impl/src/com/siyeh/ig/threading/WaitNotifyNotInSynchronizedContextInspection.java +++ b/java/java-analysis-impl/src/com/siyeh/ig/threading/WaitNotifyNotInSynchronizedContextInspection.java @@ -2,7 +2,7 @@ package com.siyeh.ig.threading; import com.intellij.codeInspection.concurrencyAnnotations.JCiPUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.psi.util.PsiUtil; @@ -43,7 +43,7 @@ public final class WaitNotifyNotInSynchronizedContextInspection extends BaseInsp if (isSynchronizedOnThis(expression) || isCoveredByGuardedByAnnotation(expression, "this")) { return; } - registerError(expression, PsiKeywords.THIS); + registerError(expression, JavaKeywords.THIS); } else if (qualifier instanceof PsiReferenceExpression) { if (isSynchronizedOn(expression, qualifier)) { diff --git a/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java b/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java index 8c6c771def4e..3c33604ef0d9 100644 --- a/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java +++ b/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.editorActions.smartEnter; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -66,7 +66,7 @@ public class IfConditionFixer implements Fixer { PsiElement psi = BasicJavaAstTreeUtil.toPsi(astNode); if (psi != null) { PsiElement prevLeaf = PsiTreeUtil.prevVisibleLeaf(psi); - if (prevLeaf != null && prevLeaf.textMatches(PsiKeywords.IF)) { + if (prevLeaf != null && prevLeaf.textMatches(JavaKeywords.IF)) { Document doc = editor.getDocument(); doc.insertString(astNode.getTextRange().getEndOffset(), ")"); doc.insertString(astNode.getTextRange().getStartOffset(), "("); diff --git a/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java b/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java index 69d260d5a73e..f94ab1869473 100644 --- a/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java +++ b/java/java-frontback-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.editorActions.smartEnter; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; @@ -34,7 +34,7 @@ public class MissingIfBranchesFixer implements Fixer { @NotNull ASTNode beforeBranch, @Nullable ASTNode branch) { if (BasicJavaAstTreeUtil.is(branch, BASIC_BLOCK_STATEMENT) || - PsiKeywords.ELSE.equals(beforeBranch.getText()) && BasicJavaAstTreeUtil.is(branch, BASIC_IF_STATEMENT)) { + JavaKeywords.ELSE.equals(beforeBranch.getText()) && BasicJavaAstTreeUtil.is(branch, BASIC_IF_STATEMENT)) { return; } boolean transformingOneLiner = branch != null && (startLine(doc, beforeBranch) == startLine(doc, branch) || diff --git a/java/java-frontback-psi-api/src/com/intellij/psi/PsiKeyword.java b/java/java-frontback-psi-api/src/com/intellij/psi/PsiKeyword.java index 41f1bee10a8e..cb0eb495b2c5 100644 --- a/java/java-frontback-psi-api/src/com/intellij/psi/PsiKeyword.java +++ b/java/java-frontback-psi-api/src/com/intellij/psi/PsiKeyword.java @@ -6,365 +6,365 @@ import com.intellij.openapi.util.NlsSafe; /** * Represents a Java keyword. *

- * For constants representing all keywords and literals of the Java language use {@link com.intellij.java.syntax.parser.PsiKeywords} + * For constants representing all keywords and literals of the Java language use {@link com.intellij.java.syntax.parser.JavaKeywords} */ public interface PsiKeyword extends PsiJavaToken { /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String ABSTRACT = "abstract"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String ASSERT = "assert"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String BOOLEAN = "boolean"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String BREAK = "break"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String BYTE = "byte"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String CASE = "case"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String CATCH = "catch"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String CHAR = "char"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String CLASS = "class"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String CONST = "const"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String CONTINUE = "continue"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String DEFAULT = "default"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String DO = "do"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String DOUBLE = "double"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String ELSE = "else"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String ENUM = "enum"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String EXTENDS = "extends"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String FINAL = "final"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String FINALLY = "finally"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String FLOAT = "float"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String FOR = "for"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String GOTO = "goto"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String IF = "if"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String IMPLEMENTS = "implements"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String IMPORT = "import"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String INSTANCEOF = "instanceof"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String INT = "int"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String INTERFACE = "interface"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String LONG = "long"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String NATIVE = "native"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String NEW = "new"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String PACKAGE = "package"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String PRIVATE = "private"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String PROTECTED = "protected"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String PUBLIC = "public"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String RETURN = "return"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String SHORT = "short"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String STATIC = "static"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String STRICTFP = "strictfp"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String SUPER = "super"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String SWITCH = "switch"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String SYNCHRONIZED = "synchronized"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String THIS = "this"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String THROW = "throw"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String THROWS = "throws"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String TRANSIENT = "transient"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String TRY = "try"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String VOID = "void"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String VOLATILE = "volatile"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String WHILE = "while"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String TRUE = "true"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String FALSE = "false"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String NULL = "null"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String NON_SEALED = "non-sealed"; // soft keywords: /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String EXPORTS = "exports"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String MODULE = "module"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String OPEN = "open"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String OPENS = "opens"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String PERMITS = "permits"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String PROVIDES = "provides"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String RECORD = "record"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String REQUIRES = "requires"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String SEALED = "sealed"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String TO = "to"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String TRANSITIVE = "transitive"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String USES = "uses"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String VALUE = "value"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String VAR = "var"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String WHEN = "when"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String WITH = "with"; /** - * @deprecated Use {@link com.intellij.java.syntax.parser.PsiKeywords} instead + * @deprecated Use {@link com.intellij.java.syntax.parser.JavaKeywords} instead */ @Deprecated @NlsSafe String YIELD = "yield"; } \ No newline at end of file diff --git a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicDeclarationParser.java b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicDeclarationParser.java index a22a4c670bbf..6aadfae1536a 100644 --- a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicDeclarationParser.java +++ b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicDeclarationParser.java @@ -2,7 +2,7 @@ package com.intellij.lang.java.parser; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.PsiBuilder; import com.intellij.lang.PsiBuilderUtil; import com.intellij.openapi.util.Pair; @@ -122,7 +122,7 @@ public class BasicDeclarationParser { refParser.parseReferenceList(builder, JavaTokenType.IMPLEMENTS_KEYWORD, myJavaElementTypeContainer.IMPLEMENTS_LIST, JavaTokenType.COMMA); if (builder.getTokenType() == JavaTokenType.IDENTIFIER && - PsiKeywords.PERMITS.equals(builder.getTokenText())) { + JavaKeywords.PERMITS.equals(builder.getTokenText())) { builder.remapCurrentToken(JavaTokenType.PERMITS_KEYWORD); } if (builder.getTokenType() == JavaTokenType.PERMITS_KEYWORD) { @@ -416,7 +416,7 @@ public class BasicDeclarationParser { } static boolean isRecordToken(PsiBuilder builder, IElementType tokenType) { - if (tokenType == JavaTokenType.IDENTIFIER && PsiKeywords.RECORD.equals(builder.getTokenText())) { + if (tokenType == JavaTokenType.IDENTIFIER && JavaKeywords.RECORD.equals(builder.getTokenText())) { IElementType nextToken = builder.lookAhead(1); if (nextToken == JavaTokenType.IDENTIFIER || // The following tokens cannot be part of a valid record declaration, @@ -432,13 +432,13 @@ public class BasicDeclarationParser { private static boolean isSealedToken(PsiBuilder builder, IElementType tokenType) { return JavaFeature.SEALED_CLASSES.isSufficient(getLanguageLevel(builder)) && tokenType == JavaTokenType.IDENTIFIER && - PsiKeywords.SEALED.equals(builder.getTokenText()); + JavaKeywords.SEALED.equals(builder.getTokenText()); } private static boolean isValueToken(PsiBuilder builder, IElementType tokenType) { return JavaFeature.VALHALLA_VALUE_CLASSES.isSufficient(getLanguageLevel(builder)) && tokenType == JavaTokenType.IDENTIFIER && - PsiKeywords.VALUE.equals(builder.getTokenText()); + JavaKeywords.VALUE.equals(builder.getTokenText()); } static boolean isNonSealedToken(PsiBuilder builder, IElementType tokenType) { @@ -451,7 +451,7 @@ public class BasicDeclarationParser { } PsiBuilder.Marker maybeNonSealed = builder.mark(); PsiBuilderUtil.advance(builder, 2); - boolean isNonSealed = PsiKeywords.SEALED.equals(builder.getTokenText()); + boolean isNonSealed = JavaKeywords.SEALED.equals(builder.getTokenText()); maybeNonSealed.rollbackTo(); return isNonSealed; } diff --git a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicFileParser.java b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicFileParser.java index fd5da0096afe..4d3872a0438f 100644 --- a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicFileParser.java +++ b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicFileParser.java @@ -3,7 +3,7 @@ package com.intellij.lang.java.parser; import com.intellij.AbstractBundle; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.PsiBuilder; import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.Pair; @@ -112,7 +112,7 @@ public class BasicFileParser { if (IMPORT_LIST_STOPPER_SET.contains(type) || BasicDeclarationParser.isRecordToken(b, type)) return true; if (type == JavaTokenType.IDENTIFIER) { String text = b.getTokenText(); - if (PsiKeywords.OPEN.equals(text) || PsiKeywords.MODULE.equals(text)) return true; + if (JavaKeywords.OPEN.equals(text) || JavaKeywords.MODULE.equals(text)) return true; } return false; } @@ -208,7 +208,7 @@ public class BasicFileParser { //if it is `module` we should expect either `;` or `identifier` if (isOk && !isModule && !isStatic && builder.getTokenType() != JavaTokenType.SEMICOLON && - PsiKeywords.MODULE.equals(identifierText)) { + JavaKeywords.MODULE.equals(identifierText)) { BasicJavaParserUtil.error(builder, JavaPsiBundle.message("expected.identifier.or.semicolon")); } else if (isOk) { @@ -226,7 +226,7 @@ public class BasicFileParser { return myJavaElementTypeContainer.IMPORT_STATIC_STATEMENT; } if (type == JavaTokenType.IDENTIFIER && - PsiKeywords.MODULE.equals(builder.getTokenText()) && + JavaKeywords.MODULE.equals(builder.getTokenText()) && builder.lookAhead(1) == JavaTokenType.IDENTIFIER) { builder.remapCurrentToken(JavaTokenType.MODULE_KEYWORD); builder.advanceLexer(); diff --git a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicModuleParser.java b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicModuleParser.java index 554b0f096599..f74270ecc6e2 100644 --- a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicModuleParser.java +++ b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicModuleParser.java @@ -2,7 +2,7 @@ package com.intellij.lang.java.parser; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.PsiBuilder; import com.intellij.openapi.util.NlsContexts; import com.intellij.psi.JavaTokenType; @@ -27,7 +27,7 @@ import static com.intellij.lang.java.parser.BasicJavaParserUtil.semicolon; @Deprecated public class BasicModuleParser { private static final Set STATEMENT_KEYWORDS = - ContainerUtil.newHashSet(PsiKeywords.REQUIRES, PsiKeywords.EXPORTS, PsiKeywords.USES, PsiKeywords.PROVIDES); + ContainerUtil.newHashSet(JavaKeywords.REQUIRES, JavaKeywords.EXPORTS, JavaKeywords.USES, JavaKeywords.PROVIDES); private final BasicJavaParser myParser; private final AbstractBasicJavaElementTypeFactory.JavaElementTypeContainer myJavaElementTypeContainer; @@ -45,19 +45,19 @@ public class BasicModuleParser { IElementType type = builder.getTokenType(); String text = type == JavaTokenType.IDENTIFIER ? builder.getTokenText() : null; - if (!(PsiKeywords.OPEN.equals(text) || PsiKeywords.MODULE.equals(text))) { + if (!(JavaKeywords.OPEN.equals(text) || JavaKeywords.MODULE.equals(text))) { module.rollbackTo(); return null; } PsiBuilder.Marker modifierList = firstAnnotation != null ? firstAnnotation.precede() : builder.mark(); - if (PsiKeywords.OPEN.equals(text)) { + if (JavaKeywords.OPEN.equals(text)) { mapAndAdvance(builder, JavaTokenType.OPEN_KEYWORD); text = builder.getTokenText(); } BasicJavaParserUtil.done(modifierList, myJavaElementTypeContainer.MODIFIER_LIST, builder, myWhiteSpaceAndCommentSetHolder); - if (PsiKeywords.MODULE.equals(text)) { + if (JavaKeywords.MODULE.equals(text)) { mapAndAdvance(builder, JavaTokenType.MODULE_KEYWORD); } else { @@ -169,11 +169,11 @@ public class BasicModuleParser { private PsiBuilder.Marker parseStatement(PsiBuilder builder) { String kw = builder.getTokenText(); - if (PsiKeywords.REQUIRES.equals(kw)) return parseRequiresStatement(builder); - if (PsiKeywords.EXPORTS.equals(kw)) return parseExportsStatement(builder); - if (PsiKeywords.OPENS.equals(kw)) return parseOpensStatement(builder); - if (PsiKeywords.USES.equals(kw)) return parseUsesStatement(builder); - if (PsiKeywords.PROVIDES.equals(kw)) return parseProvidesStatement(builder); + if (JavaKeywords.REQUIRES.equals(kw)) return parseRequiresStatement(builder); + if (JavaKeywords.EXPORTS.equals(kw)) return parseExportsStatement(builder); + if (JavaKeywords.OPENS.equals(kw)) return parseOpensStatement(builder); + if (JavaKeywords.USES.equals(kw)) return parseUsesStatement(builder); + if (JavaKeywords.PROVIDES.equals(kw)) return parseProvidesStatement(builder); return null; } @@ -184,7 +184,7 @@ public class BasicModuleParser { PsiBuilder.Marker modifierList = builder.mark(); while (true) { if (expect(builder, BasicElementTypes.BASIC_MODIFIER_BIT_SET)) continue; - if (builder.getTokenType() == JavaTokenType.IDENTIFIER && PsiKeywords.TRANSITIVE.equals(builder.getTokenText())) { + if (builder.getTokenType() == JavaTokenType.IDENTIFIER && JavaKeywords.TRANSITIVE.equals(builder.getTokenText())) { mapAndAdvance(builder, JavaTokenType.TRANSITIVE_KEYWORD); continue; } @@ -219,7 +219,7 @@ public class BasicModuleParser { boolean hasError = false; if (parseClassOrPackageRef(builder) != null) { - if (PsiKeywords.TO.equals(builder.getTokenText())) { + if (JavaKeywords.TO.equals(builder.getTokenText())) { mapAndAdvance(builder, JavaTokenType.TO_KEYWORD); while (true) { @@ -273,7 +273,7 @@ public class BasicModuleParser { hasError = true; } - if (PsiKeywords.WITH.equals(builder.getTokenText())) { + if (JavaKeywords.WITH.equals(builder.getTokenText())) { builder.remapCurrentToken(JavaTokenType.WITH_KEYWORD); hasError = myParser.getReferenceParser().parseReferenceList(builder, JavaTokenType.WITH_KEYWORD, myJavaElementTypeContainer.PROVIDES_WITH_LIST, JavaTokenType.COMMA); } diff --git a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicPatternParser.java b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicPatternParser.java index 7bd2fb4a93ea..8b4b6c8caecc 100644 --- a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicPatternParser.java +++ b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicPatternParser.java @@ -2,7 +2,7 @@ package com.intellij.lang.java.parser; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.PsiBuilder; import com.intellij.psi.JavaTokenType; import com.intellij.psi.impl.source.AbstractBasicJavaElementTypeFactory; @@ -147,7 +147,7 @@ public class BasicPatternParser { final boolean hasIdentifier; if (builder.getTokenType() == JavaTokenType.IDENTIFIER && - (!PsiKeywords.WHEN.equals(builder.getTokenText()) || isWhenAsIdentifier(isRecord))) { + (!JavaKeywords.WHEN.equals(builder.getTokenText()) || isWhenAsIdentifier(isRecord))) { // pattern variable after the record structure pattern if (isRecord) { PsiBuilder.Marker variable = builder.mark(); diff --git a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicReferenceParser.java b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicReferenceParser.java index 8f0755312f2b..92cf4c4baba0 100644 --- a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicReferenceParser.java +++ b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicReferenceParser.java @@ -2,7 +2,7 @@ package com.intellij.lang.java.parser; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.PsiBuilder; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.JavaTokenType; @@ -96,7 +96,7 @@ public class BasicReferenceParser { isSet(flags, VAR_TYPE) && builder.lookAhead(1) != JavaTokenType.DOT && builder.lookAhead(1) != JavaTokenType.COLON && - PsiKeywords.VAR.equals(builder.getTokenText()) && + JavaKeywords.VAR.equals(builder.getTokenText()) && JavaFeature.LVTI.isSufficient(getLanguageLevel(builder))) { builder.remapCurrentToken(tokenType = JavaTokenType.VAR_KEYWORD); } diff --git a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicStatementParser.java b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicStatementParser.java index ad0cd5667dad..a1e32a8273d5 100644 --- a/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicStatementParser.java +++ b/java/java-frontback-psi-impl/src/com/intellij/lang/java/parser/BasicStatementParser.java @@ -2,7 +2,7 @@ package com.intellij.lang.java.parser; import com.intellij.core.JavaPsiBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.PsiBuilder; import com.intellij.lang.WhitespacesBinders; import com.intellij.openapi.util.Pair; @@ -248,10 +248,10 @@ public class BasicStatementParser { pos.rollbackTo(); if (singleToken && builder.getTokenType() == JavaTokenType.IDENTIFIER) { String text = builder.getTokenText(); - if (PsiKeywords.RECORD.equals(text) && JavaFeature.RECORDS.isSufficient(getLanguageLevel(builder))) { + if (JavaKeywords.RECORD.equals(text) && JavaFeature.RECORDS.isSufficient(getLanguageLevel(builder))) { incompleteDeclarationRestrictedTokenType = JavaTokenType.RECORD_KEYWORD; } - if (PsiKeywords.VAR.equals(text) && JavaFeature.LVTI.isSufficient(getLanguageLevel(builder))) { + if (JavaKeywords.VAR.equals(text) && JavaFeature.LVTI.isSufficient(getLanguageLevel(builder))) { incompleteDeclarationRestrictedTokenType = JavaTokenType.VAR_KEYWORD; } } @@ -297,7 +297,7 @@ public class BasicStatementParser { private static boolean isStmtYieldToken(@NotNull PsiBuilder builder, IElementType tokenType) { if (!(tokenType == JavaTokenType.IDENTIFIER && - PsiKeywords.YIELD.equals(builder.getTokenText()) && + JavaKeywords.YIELD.equals(builder.getTokenText()) && JavaFeature.SWITCH_EXPRESSION.isSufficient(getLanguageLevel(builder)))) { return false; } @@ -641,7 +641,7 @@ public class BasicStatementParser { } private void parseGuard(PsiBuilder builder) { - if (builder.getTokenType() == JavaTokenType.IDENTIFIER && PsiKeywords.WHEN.equals(builder.getTokenText())) { + if (builder.getTokenType() == JavaTokenType.IDENTIFIER && JavaKeywords.WHEN.equals(builder.getTokenText())) { builder.remapCurrentToken(JavaTokenType.WHEN_KEYWORD); builder.advanceLexer(); PsiBuilder.Marker guardingExpression = myParser.getExpressionParser().parseAssignmentForbiddingLambda(builder); diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/BulkFileAttributesReadInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/BulkFileAttributesReadInspection.java index 46895b1c81e1..6a84c8c49ac6 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/BulkFileAttributesReadInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/BulkFileAttributesReadInspection.java @@ -3,7 +3,7 @@ package com.intellij.codeInspection; import com.intellij.codeInsight.ExceptionUtil; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -258,7 +258,7 @@ public final class BulkFileAttributesReadInspection extends AbstractBaseJavaLoca && PsiUtil.isAvailable(JavaFeature.LVTI, parent) && JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_VAR_TYPE ) { - displayType = TypeUtils.getType(PsiKeywords.VAR, parent.getContext()); + displayType = TypeUtils.getType(JavaKeywords.VAR, parent.getContext()); } else { displayType = type; } diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java index 0cb733799d54..36113cf2fc1b 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/DuplicateBranchesInSwitchInspection.java @@ -3,7 +3,7 @@ package com.intellij.codeInspection; import com.intellij.codeInspection.util.InspectionMessage; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.diagnostic.Logger; @@ -732,13 +732,13 @@ public final class DuplicateBranchesInSwitchInspection extends LocalInspectionTo static @Nullable String getSwitchLabelText(@Nullable PsiSwitchLabelStatementBase switchLabel) { if (switchLabel != null) { if (switchLabel.isDefaultCase()) { - return PsiKeywords.DEFAULT; + return JavaKeywords.DEFAULT; } PsiCaseLabelElementList labelElementList = switchLabel.getCaseLabelElementList(); if (labelElementList != null) { PsiCaseLabelElement[] expressions = labelElementList.getElements(); if (expressions.length != 0) { - return PsiKeywords.CASE + ' ' + expressions[0].getText(); + return JavaKeywords.CASE + ' ' + expressions[0].getText(); } } } diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/ExplicitArrayFillingInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/ExplicitArrayFillingInspection.java index 67e363d8a862..f62a86af8e71 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/ExplicitArrayFillingInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/ExplicitArrayFillingInspection.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.intention.QuickFixFactory; import com.intellij.codeInspection.options.OptPane; import com.intellij.codeInspection.util.LambdaGenerationUtil; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.diagnostic.Logger; @@ -70,7 +70,7 @@ public final class ExplicitArrayFillingInspection extends AbstractBaseJavaLocalI holder.registerProblem(statement, getRange(statement, ProblemHighlightType.WARNING), JavaBundle.message("inspection.explicit.array.filling.redundant.loop.description"), QuickFixFactory.getInstance() - .createDeleteFix(statement, CommonQuickFixBundle.message("fix.remove.statement", PsiKeywords.FOR))); + .createDeleteFix(statement, CommonQuickFixBundle.message("fix.remove.statement", JavaKeywords.FOR))); return; } registerProblem(statement, false); diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/classCanBeRecord/ConvertToRecordFix.java b/java/java-impl-inspections/src/com/intellij/codeInspection/classCanBeRecord/ConvertToRecordFix.java index 36e3541ea8ca..95084ab6560d 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/classCanBeRecord/ConvertToRecordFix.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/classCanBeRecord/ConvertToRecordFix.java @@ -8,7 +8,7 @@ import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo; import com.intellij.codeInspection.ProblemDescriptor; import com.intellij.codeInspection.util.IntentionFamilyName; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.jvm.JvmModifier; import com.intellij.openapi.project.Project; import com.intellij.psi.*; @@ -287,7 +287,7 @@ public class ConvertToRecordFix extends InspectionGadgetsFix { private static boolean hasSuperQualifier(@NotNull PsiReferenceExpression expression) { PsiElement qualifier = expression.getQualifier(); - return qualifier != null && PsiKeywords.SUPER.equals(qualifier.getText()); + return qualifier != null && JavaKeywords.SUPER.equals(qualifier.getText()); } }; psiMethod.accept(visitor); diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/ConstantValueInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/ConstantValueInspection.java index 9d02553f77e3..6ff60e715d0f 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/ConstantValueInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/ConstantValueInspection.java @@ -17,7 +17,7 @@ import com.intellij.codeInspection.dataFlow.types.DfType; import com.intellij.codeInspection.dataFlow.types.DfTypes; import com.intellij.codeInspection.options.OptPane; import com.intellij.java.analysis.JavaAnalysisBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModCommandAction; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.text.StringUtil; @@ -102,9 +102,9 @@ public final class ConstantValueInspection extends AbstractBaseJavaLocalInspecti private void checkSwitchCaseGuard(@Nullable PsiExpression guard) { if (guard == null) return; if (BoolUtils.isTrue(guard)) { - LocalQuickFix fix = createSimplifyBooleanExpressionFix(guard, guard.textMatches(PsiKeywords.TRUE)); + LocalQuickFix fix = createSimplifyBooleanExpressionFix(guard, guard.textMatches(JavaKeywords.TRUE)); holder.registerProblem(guard, JavaAnalysisBundle - .message("dataflow.message.constant.no.ref", guard.textMatches(PsiKeywords.TRUE) ? 1 : 0), LocalQuickFix.notNullElements(fix)); + .message("dataflow.message.constant.no.ref", guard.textMatches(JavaKeywords.TRUE) ? 1 : 0), LocalQuickFix.notNullElements(fix)); } } @@ -112,16 +112,16 @@ public final class ConstantValueInspection extends AbstractBaseJavaLocalInspecti public void visitIfStatement(@NotNull PsiIfStatement statement) { PsiExpression condition = PsiUtil.skipParenthesizedExprDown(statement.getCondition()); if (BoolUtils.isBooleanLiteral(condition)) { - LocalQuickFix fix = createSimplifyBooleanExpressionFix(condition, condition.textMatches(PsiKeywords.TRUE)); + LocalQuickFix fix = createSimplifyBooleanExpressionFix(condition, condition.textMatches(JavaKeywords.TRUE)); holder.registerProblem(condition, JavaAnalysisBundle - .message("dataflow.message.constant.no.ref", condition.textMatches(PsiKeywords.TRUE) ? 1 : 0), LocalQuickFix.notNullElements(fix)); + .message("dataflow.message.constant.no.ref", condition.textMatches(JavaKeywords.TRUE) ? 1 : 0), LocalQuickFix.notNullElements(fix)); } } @Override public void visitDoWhileStatement(@NotNull PsiDoWhileStatement statement) { PsiExpression condition = PsiUtil.skipParenthesizedExprDown(statement.getCondition()); - if (condition != null && condition.textMatches(PsiKeywords.FALSE)) { + if (condition != null && condition.textMatches(JavaKeywords.FALSE)) { LocalQuickFix fix = createSimplifyBooleanExpressionFix(condition, false); if (fix != null) { holder.registerProblem(condition, JavaAnalysisBundle.message("dataflow.message.constant.no.ref", 0), diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/UnreachableCodeInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/UnreachableCodeInspection.java index c98ad73c9569..4403d4dbcda9 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/UnreachableCodeInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/dataFlow/UnreachableCodeInspection.java @@ -6,7 +6,7 @@ import com.intellij.codeInspection.ProblemsHolder; import com.intellij.codeInspection.SuppressionUtil; import com.intellij.codeInspection.options.OptPane; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.text.HtmlChunk; import com.intellij.psi.*; @@ -186,7 +186,7 @@ public final class UnreachableCodeInspection extends AbstractBaseJavaLocalInspec if (value instanceof Boolean || "".equals(value) || value instanceof Number number && number.doubleValue() == 0.0) { return true; } - if (literal.textMatches(PsiKeywords.NULL)) return true; + if (literal.textMatches(JavaKeywords.NULL)) return true; } return false; } diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/enhancedSwitch/SwitchLabeledRuleCanBeCodeBlockInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/enhancedSwitch/SwitchLabeledRuleCanBeCodeBlockInspection.java index fc4cc066c939..0f78ccc5eaa3 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/enhancedSwitch/SwitchLabeledRuleCanBeCodeBlockInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/enhancedSwitch/SwitchLabeledRuleCanBeCodeBlockInspection.java @@ -3,7 +3,7 @@ package com.intellij.codeInspection.enhancedSwitch; import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool; import com.intellij.codeInspection.ProblemsHolder; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.application.ApplicationManager; @@ -98,7 +98,7 @@ public final class SwitchLabeledRuleCanBeCodeBlockInspection extends AbstractBas private static void wrapExpression(PsiExpressionStatement expressionStatement) { CommentTracker tracker = new CommentTracker(); - String valueKeyword = PsiKeywords.YIELD; + String valueKeyword = JavaKeywords.YIELD; tracker.replaceAndRestoreComments(expressionStatement, "{ " + valueKeyword + " " + tracker.text(expressionStatement) + "\n }"); } diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/java19api/ModuleInfo.java b/java/java-impl-inspections/src/com/intellij/codeInspection/java19api/ModuleInfo.java index 29ac750a624e..343b21e5d54b 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/java19api/ModuleInfo.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/java19api/ModuleInfo.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInspection.java19api; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.application.ReadAction; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.PsiDirectory; @@ -33,7 +33,7 @@ record ModuleInfo(@NotNull PsiDirectory rootDir, @NotNull ModuleNode node) { CharSequence requires = requiresText(); CharSequence exports = exportsText(); - return new StringBuilder().append(PsiKeywords.MODULE).append(" ").append(node().getName()).append(" {\n") + return new StringBuilder().append(JavaKeywords.MODULE).append(" ").append(node().getName()).append(" {\n") .append(requires) .append((!requires.isEmpty() && !exports.isEmpty()) ? "\n" : "") .append(exports) @@ -49,12 +49,12 @@ record ModuleInfo(@NotNull PsiDirectory rootDir, @NotNull ModuleNode node) { boolean isBadSyntax = ContainerUtil.or(dependencyName.split("\\."), part -> PsiUtil.isKeyword(part, LanguageLevel.JDK_1_9)); - text.append(isBadSyntax ? "// " : " ").append(PsiKeywords.REQUIRES).append(' '); + text.append(isBadSyntax ? "// " : " ").append(JavaKeywords.REQUIRES).append(' '); if(dependency.getValue().contains(STATIC)) { - text.append(PsiKeywords.STATIC).append(' '); + text.append(JavaKeywords.STATIC).append(' '); } if(dependency.getValue().contains(TRANSITIVE)) { - text.append(PsiKeywords.TRANSITIVE).append(' '); + text.append(JavaKeywords.TRANSITIVE).append(' '); } text.append(dependencyName).append(";\n"); } @@ -64,7 +64,7 @@ record ModuleInfo(@NotNull PsiDirectory rootDir, @NotNull ModuleNode node) { private @NotNull CharSequence exportsText() { StringBuilder text = new StringBuilder(); for (String packageName : node().getExports()) { - text.append(PsiKeywords.EXPORTS).append(' ').append(packageName).append(";\n"); + text.append(JavaKeywords.EXPORTS).append(' ').append(packageName).append(";\n"); } return text; } diff --git a/java/java-impl-inspections/src/com/intellij/codeInspection/reflectiveAccess/JavaLangInvokeHandleSignatureInspection.java b/java/java-impl-inspections/src/com/intellij/codeInspection/reflectiveAccess/JavaLangInvokeHandleSignatureInspection.java index 162032afd478..e38e4becc282 100644 --- a/java/java-impl-inspections/src/com/intellij/codeInspection/reflectiveAccess/JavaLangInvokeHandleSignatureInspection.java +++ b/java/java-impl-inspections/src/com/intellij/codeInspection/reflectiveAccess/JavaLangInvokeHandleSignatureInspection.java @@ -7,7 +7,7 @@ import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo; import com.intellij.codeInsight.lookup.*; import com.intellij.codeInspection.*; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.application.ApplicationManager; @@ -314,7 +314,7 @@ public final class JavaLangInvokeHandleSignatureInspection extends AbstractBaseJ private static @NotNull String getConstructorDeclarationText(@NotNull String className, @NotNull ReflectiveSignature methodSignature) { // Return type of the constructor should be 'void'. If it isn't so let's make that mistake more noticeable. final String returnType = methodSignature.getShortReturnType(); - final String fakeReturnType = !PsiKeywords.VOID.equals(returnType) ? returnType + " " : ""; + final String fakeReturnType = !JavaKeywords.VOID.equals(returnType) ? returnType + " " : ""; return fakeReturnType + className + methodSignature.getShortArgumentTypes(); } diff --git a/java/java-impl-refactorings/src/com/intellij/java/refactoring/suggested/JavaSignaturePresentationBuilder.kt b/java/java-impl-refactorings/src/com/intellij/java/refactoring/suggested/JavaSignaturePresentationBuilder.kt index 2d505aed6bde..a69941c66c5b 100644 --- a/java/java-impl-refactorings/src/com/intellij/java/refactoring/suggested/JavaSignaturePresentationBuilder.kt +++ b/java/java-impl-refactorings/src/com/intellij/java/refactoring/suggested/JavaSignaturePresentationBuilder.kt @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.java.refactoring.suggested -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.psi.PsiModifier import com.intellij.refactoring.suggested.SignatureChangePresentationModel.Effect import com.intellij.refactoring.suggested.SignatureChangePresentationModel.TextFragment @@ -92,7 +92,7 @@ internal class JavaSignaturePresentationBuilder( exceptionTypes: List, effectAndConnectionId: (Int) -> Pair ) { - this += Leaf(PsiKeywords.THROWS) + this += Leaf(JavaKeywords.THROWS) this += LineBreak(" ", indentAfter = true) for ((index, exceptionType) in exceptionTypes.withIndex()) { diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodProcessor.java b/java/java-impl-refactorings/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodProcessor.java index 2127108f68b8..1dcd02b58abe 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodProcessor.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/convertToInstanceMethod/ConvertToInstanceMethodProcessor.java @@ -4,7 +4,7 @@ package com.intellij.refactoring.convertToInstanceMethod; import com.intellij.codeInsight.ChangeContextUtil; import com.intellij.ide.util.EditorHelper; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; @@ -449,7 +449,7 @@ public final class ConvertToInstanceMethodProcessor extends BaseRefactoringProce } private @NotNull PsiExpression createThisExpression() { - return JavaPsiFacade.getElementFactory(myProject).createExpressionFromText(PsiKeywords.THIS, null); + return JavaPsiFacade.getElementFactory(myProject).createExpressionFromText(JavaKeywords.THIS, null); } private void processMethodCall(final PsiMethodCallExpression methodCall) { diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java index 326264808f1c..fbf40e5ae586 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/extractMethod/ExtractMethodProcessor.java @@ -21,7 +21,7 @@ import com.intellij.codeInspection.redundantCast.RemoveRedundantCastUtil; import com.intellij.ide.DataManager; import com.intellij.ide.util.PropertiesComponent; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.diagnostic.Logger; @@ -1796,7 +1796,7 @@ public class ExtractMethodProcessor implements MatchProvider { final boolean skipInstanceQualifier; if (myIsChainedConstructor) { skipInstanceQualifier = true; - buffer.append(PsiKeywords.THIS); + buffer.append(JavaKeywords.THIS); } else { skipInstanceQualifier = instanceQualifier == null || instanceQualifier instanceof PsiThisExpression; diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java b/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java index 4085a7d84ffb..aa35761a0081 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousClassHandler.java @@ -4,7 +4,7 @@ package com.intellij.refactoring.inline; import com.intellij.codeInsight.TargetElementUtil; import com.intellij.java.JavaBundle; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; @@ -40,7 +40,7 @@ public final class InlineToAnonymousClassHandler extends JavaInlineActionHandler static final ElementPattern ourCatchClausePattern = PlatformPatterns.psiElement(PsiTypeElement.class).withParent(PlatformPatterns.psiElement(PsiParameter.class).withParent( PlatformPatterns.psiElement(PsiCatchSection.class))); static final ElementPattern ourThrowsClausePattern = PlatformPatterns.psiElement().withParent(PlatformPatterns.psiElement(PsiReferenceList.class).withFirstChild( - PlatformPatterns.psiElement().withText(PsiKeywords.THROWS))); + PlatformPatterns.psiElement().withText(JavaKeywords.THROWS))); @Override public boolean isEnabledOnElement(PsiElement element) { diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousConstructorProcessor.java b/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousConstructorProcessor.java index 6c5afe75d25d..d1ff979f98a5 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousConstructorProcessor.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/inline/InlineToAnonymousConstructorProcessor.java @@ -3,7 +3,7 @@ package com.intellij.refactoring.inline; import com.intellij.codeInsight.ChangeContextUtil; import com.intellij.codeInspection.AnonymousCanBeLambdaInspection; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; @@ -36,14 +36,14 @@ class InlineToAnonymousConstructorProcessor { private static final Key ourAssignmentKey = Key.create("assignment"); private static final Key ourCallKey = Key.create("call"); - public static final ElementPattern ourNullPattern = psiElement(PsiLiteralExpression.class).withText(PsiKeywords.NULL); + public static final ElementPattern ourNullPattern = psiElement(PsiLiteralExpression.class).withText(JavaKeywords.NULL); private static final ElementPattern ourAssignmentPattern = psiExpressionStatement().withChild(psiElement(PsiAssignmentExpression.class).save(ourAssignmentKey)); private static final ElementPattern ourSuperCallPattern = psiExpressionStatement().withFirstChild( - psiElement(PsiMethodCallExpression.class).save(ourCallKey).withFirstChild(psiElement().withText(PsiKeywords.SUPER))); + psiElement(PsiMethodCallExpression.class).save(ourCallKey).withFirstChild(psiElement().withText(JavaKeywords.SUPER))); private static final ElementPattern ourThisCallPattern = psiExpressionStatement().withFirstChild(psiElement(PsiMethodCallExpression.class).withFirstChild( - psiElement().withText(PsiKeywords.THIS))); + psiElement().withText(JavaKeywords.THIS))); private final PsiClass myClass; private PsiNewExpression myNewExpression; diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java index e853bae5bac4..6863432169c0 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceParameter/IntroduceParameterProcessor.java @@ -8,7 +8,7 @@ import com.intellij.codeInsight.generation.GenerateMembersUtil; import com.intellij.codeInspection.AnonymousCanBeLambdaInspection; import com.intellij.codeInspection.LambdaCanBeMethodReferenceInspection; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.findUsages.DescriptiveNameUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -274,7 +274,7 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem if (!(element instanceof PsiMethod) && !(usageInfo instanceof InternalUsageInfo)) { if (!PsiTreeUtil.isAncestor(myMethodToReplaceIn.getContainingClass(), element, false)) { String message = JavaRefactoringBundle.message("parameter.initializer.contains.0.but.not.all.calls.to.method.are.in.its.class", - CommonRefactoringUtil.htmlEmphasize(PsiKeywords.SUPER)); + CommonRefactoringUtil.htmlEmphasize(JavaKeywords.SUPER)); conflicts.putValue(myParameterInitializer, message); break; } diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java index cff0cef111ad..ce4af2978e20 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/introduceparameterobject/ParameterObjectBuilder.java @@ -3,7 +3,7 @@ package com.intellij.refactoring.introduceparameterobject; import com.intellij.application.options.CodeStyle; import com.intellij.codeInsight.generation.GenerateMembersUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.pom.java.JavaFeature; @@ -70,7 +70,7 @@ class ParameterObjectBuilder { if (!packageName.isEmpty()) out.append("package ").append(packageName).append(';'); out.append('\n'); out.append(myVisibility).append(" "); - out.append(recordsAvailable ? PsiKeywords.RECORD : PsiKeywords.CLASS); + out.append(recordsAvailable ? JavaKeywords.RECORD : JavaKeywords.CLASS); out.append(" ").append(className); if (!typeParams.isEmpty()) { out.append('<'); diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveClassesOrPackages/ModuleInfoModifyUsageDetector.java b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveClassesOrPackages/ModuleInfoModifyUsageDetector.java index f2fe1cbb83e4..9eceacb8508a 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveClassesOrPackages/ModuleInfoModifyUsageDetector.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/move/moveClassesOrPackages/ModuleInfoModifyUsageDetector.java @@ -3,7 +3,7 @@ package com.intellij.refactoring.move.moveClassesOrPackages; import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.PackageIndex; import com.intellij.openapi.util.text.StringUtil; @@ -208,10 +208,10 @@ class ModuleInfoModifyUsageDetector extends ModuleInfoUsageDetector { private static @NotNull String formModuleStatementText(@NotNull PsiPackageAccessibilityStatement.Role role, @NotNull Set moduleRefNames, @NotNull String packageName) { String roleText = null; if (role == PsiPackageAccessibilityStatement.Role.EXPORTS) { - roleText = PsiKeywords.EXPORTS; + roleText = JavaKeywords.EXPORTS; } else if (role == PsiPackageAccessibilityStatement.Role.OPENS) { - roleText = PsiKeywords.OPENS; + roleText = JavaKeywords.OPENS; } assert roleText != null; String moduleRefsText; diff --git a/java/java-impl-refactorings/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java b/java/java-impl-refactorings/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java index bd00acbb1fe4..71f6a0003ded 100644 --- a/java/java-impl-refactorings/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java +++ b/java/java-impl-refactorings/src/com/intellij/refactoring/safeDelete/JavaSafeDeleteProcessor.java @@ -10,7 +10,7 @@ import com.intellij.codeInspection.dataFlow.JavaMethodContractUtil; import com.intellij.find.findUsages.PsiElement2UsageTargetAdapter; import com.intellij.ide.util.SuperMethodWarningUtil; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; @@ -882,7 +882,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase { private static @Nullable PsiMethod getOverridingConstructorOfSuperCall(PsiElement element) { if (element instanceof PsiReferenceExpression ref && - PsiKeywords.SUPER.equals(element.getText()) && + JavaKeywords.SUPER.equals(element.getText()) && ref.getParent() instanceof PsiMethodCallExpression call && call.getParent() instanceof PsiExpressionStatement st && st.getParent() instanceof PsiCodeBlock block && diff --git a/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java b/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java index 5473bb891e1c..83d3c4e75677 100644 --- a/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java +++ b/java/java-impl/src/com/intellij/application/options/ImportLayoutPanel.java @@ -5,7 +5,7 @@ import com.intellij.icons.AllIcons; import com.intellij.ide.IdeBundle; import com.intellij.ide.highlighter.JavaHighlightingColors; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.actionSystem.ActionGroup; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonShortcuts; @@ -365,10 +365,10 @@ public abstract class ImportLayoutPanel extends JPanel { } else { TextAttributes attributes = JavaHighlightingColors.KEYWORD.getDefaultAttributes(); - append(PsiKeywords.IMPORT, SimpleTextAttributes.fromTextAttributes(attributes)); + append(JavaKeywords.IMPORT, SimpleTextAttributes.fromTextAttributes(attributes)); if (entry.isStatic()) { append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES); - append(PsiKeywords.STATIC, SimpleTextAttributes.fromTextAttributes(attributes)); + append(JavaKeywords.STATIC, SimpleTextAttributes.fromTextAttributes(attributes)); } append(" ", SimpleTextAttributes.REGULAR_ATTRIBUTES); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java index 2f5c10df0b4e..5325daaf8986 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/BasicExpressionCompletionContributor.java @@ -10,7 +10,7 @@ import com.intellij.codeInsight.template.SmartCompletionContextType; import com.intellij.codeInsight.template.impl.TemplateContextTypes; import com.intellij.codeInsight.template.impl.TemplateImpl; import com.intellij.codeInsight.template.impl.TemplateSettings; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; import com.intellij.psi.filters.getters.ClassLiteralGetter; @@ -38,8 +38,8 @@ public final class BasicExpressionCompletionContributor { PrefixMatcher matcher) { final PsiElement element = parameters.getPosition(); if (JavaKeywordCompletion.isAfterTypeDot(element)) { - addKeyword(result, element, PsiKeywords.CLASS); - addKeyword(result, element, PsiKeywords.THIS); + addKeyword(result, element, JavaKeywords.CLASS); + addKeyword(result, element, JavaKeywords.THIS); } @@ -62,8 +62,8 @@ public final class BasicExpressionCompletionContributor { } } - addKeyword(result, position, PsiKeywords.TRUE); - addKeyword(result, position, PsiKeywords.FALSE); + addKeyword(result, position, JavaKeywords.TRUE); + addKeyword(result, position, JavaKeywords.FALSE); if (!JavaCompletionContributor.IN_SWITCH_LABEL.accepts(position)) { for (PsiExpression expression : ThisGetter.getThisExpressionVariants(position)) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/CatchLookupElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/CatchLookupElement.java index 167bc599255a..2a6d18dfc7f7 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/CatchLookupElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/CatchLookupElement.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.generation.surroundWith.SurroundWithUtil; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.codeInsight.lookup.LookupItem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; @@ -54,7 +54,7 @@ final class CatchLookupElement extends LookupItem { @Override public void renderElement(@NotNull LookupElementPresentation presentation) { - int catchLength = PsiKeywords.CATCH.length(); + int catchLength = JavaKeywords.CATCH.length(); presentation.setItemText(fullItemText.substring(0, catchLength)); presentation.setItemTextBold(true); presentation.setTailText(fullItemText.substring(catchLength)); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java b/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java index 76ced4ceecd8..e8dec498bbc4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/CheckInitialized.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpressionUtil; import com.intellij.codeInsight.daemon.ImplicitUsageProvider; import com.intellij.codeInsight.hint.api.impls.MethodParameterInfoHandler; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.filters.ElementFilter; import com.intellij.psi.util.InheritanceUtil; @@ -112,7 +112,7 @@ class CheckInitialized implements ElementFilter { public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) { if (expression.getTextRange().getStartOffset() < statement.getTextRange().getStartOffset()) { final PsiReferenceExpression methodExpression = expression.getMethodExpression(); - if (methodExpression.textMatches(PsiKeywords.THIS)) { + if (methodExpression.textMatches(JavaKeywords.THIS)) { fields.clear(); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/InstanceofTypeProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/InstanceofTypeProvider.java index eeb5ed7e18db..1cb0893b9328 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/InstanceofTypeProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/InstanceofTypeProvider.java @@ -3,7 +3,7 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.PsiTypeLookupItem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.patterns.ElementPattern; import com.intellij.psi.*; import com.intellij.psi.filters.getters.InstanceOfLeftPartTypeGetter; @@ -18,7 +18,7 @@ import java.util.Set; import static com.intellij.patterns.PlatformPatterns.psiElement; final class InstanceofTypeProvider { - static final ElementPattern AFTER_INSTANCEOF = psiElement().afterLeaf(PsiKeywords.INSTANCEOF); + static final ElementPattern AFTER_INSTANCEOF = psiElement().afterLeaf(JavaKeywords.INSTANCEOF); static void addCompletions(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) { final PsiElement position = parameters.getPosition(); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java index fc7a7f55240c..12ea70a4a7ca 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCharFilter.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.lookup.CharFilter; import com.intellij.codeInsight.lookup.Lookup; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.VariableLookupItem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.patterns.PsiJavaPatterns; @@ -58,7 +58,7 @@ public final class JavaCharFilter extends CharFilter { JavaMethodCallElement methodItem = item.as(JavaMethodCallElement.class); if (methodItem != null && methodItem.isNegatable()) return Result.SELECT_ITEM_AND_FINISH_LOOKUP; - if (o instanceof PsiKeyword && ((PsiKeyword)o).textMatches(PsiKeywords.INSTANCEOF)) { + if (o instanceof PsiKeyword && ((PsiKeyword)o).textMatches(JavaKeywords.INSTANCEOF)) { return Result.SELECT_ITEM_AND_FINISH_LOOKUP; } @@ -88,7 +88,7 @@ public final class JavaCharFilter extends CharFilter { if (c == '<' && o instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP; if (c == '(') { if (o instanceof PsiClass) { - if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeywords.NEW).accepts(lookup.getPsiElement())) { + if (PsiJavaPatterns.psiElement().afterLeaf(JavaKeywords.NEW).accepts(lookup.getPsiElement())) { return Result.SELECT_ITEM_AND_FINISH_LOOKUP; } return Result.HIDE_LOOKUP; @@ -110,7 +110,7 @@ public final class JavaCharFilter extends CharFilter { return Result.SELECT_ITEM_AND_FINISH_LOOKUP; } } - if (c == '(' && PsiKeywords.RETURN.equals(item.getLookupString())) { + if (c == '(' && JavaKeywords.RETURN.equals(item.getLookupString())) { return Result.HIDE_LOOKUP; } return null; diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java index e4ccccb6bf55..ed2b05deba3c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaClassNameCompletionContributor.java @@ -8,7 +8,7 @@ import com.intellij.codeInsight.daemon.impl.analysis.JavaModuleGraphUtil.JavaMod import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.java.JavaBundle; import com.intellij.java.codeserver.core.JavaPsiModuleUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.LangBundle; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.actionSystem.IdeActions; @@ -43,7 +43,7 @@ import static com.intellij.codeInsight.completion.JavaClassNameInsertHandler.JAV import static com.intellij.patterns.PsiJavaPatterns.psiElement; public class JavaClassNameCompletionContributor extends CompletionContributor implements DumbAware { - public static final PsiJavaElementPattern.Capture AFTER_NEW = psiElement().afterLeaf(PsiKeywords.NEW); + public static final PsiJavaElementPattern.Capture AFTER_NEW = psiElement().afterLeaf(JavaKeywords.NEW); @Override public void fillCompletionVariants(@NotNull CompletionParameters parameters, final @NotNull CompletionResultSet _result) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java index 4c98271ce134..2bd8d608603d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionContributor.java @@ -13,7 +13,7 @@ import com.intellij.icons.AllIcons; import com.intellij.java.JavaBundle; import com.intellij.java.codeserver.core.JavaPsiEnumUtil; import com.intellij.java.codeserver.core.JavaPsiModuleUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.LangBundle; import com.intellij.lang.java.JavaLanguage; import com.intellij.lang.jvm.types.JvmPrimitiveTypeKind; @@ -123,7 +123,7 @@ public final class JavaCompletionContributor extends CompletionContributor imple psiElement().afterLeaf("(").withParent(psiReferenceExpression().withParent(NAME_VALUE_PAIR)), psiElement().afterLeaf(",").withParent(psiReferenceExpression().withParent(NAME_VALUE_PAIR))); private static final PsiJavaElementPattern.Capture IN_TYPE_PARAMETER = - psiElement().afterLeaf(PsiKeywords.EXTENDS, PsiKeywords.SUPER, "&").withParent( + psiElement().afterLeaf(JavaKeywords.EXTENDS, JavaKeywords.SUPER, "&").withParent( psiElement(PsiReferenceList.class).withParent(PsiTypeParameter.class)); public static final ElementPattern IN_SWITCH_LABEL = @@ -149,19 +149,19 @@ public final class JavaCompletionContributor extends CompletionContributor imple psiElement().withParent(psiElement(PsiJavaCodeReferenceElement.class).withParent(PsiImportStatementBase.class)); private static final ElementPattern CATCH_OR_FINALLY = psiElement().afterLeaf( psiElement().withText("}").withParent( - psiElement(PsiCodeBlock.class).afterLeaf(PsiKeywords.TRY))); + psiElement(PsiCodeBlock.class).afterLeaf(JavaKeywords.TRY))); private static final ElementPattern INSIDE_CONSTRUCTOR = psiElement().inside(psiMethod().constructor(true)); private static final ElementPattern AFTER_ENUM_CONSTANT = psiElement().inside(PsiTypeElement.class).afterLeaf( psiElement().inside(true, psiElement(PsiEnumConstant.class), psiElement(PsiClass.class, PsiExpressionList.class))); static final ElementPattern IN_EXTENDS_OR_IMPLEMENTS = psiElement().afterLeaf( psiElement() - .withText(string().oneOf(PsiKeywords.EXTENDS, PsiKeywords.IMPLEMENTS, ",", "&")) + .withText(string().oneOf(JavaKeywords.EXTENDS, JavaKeywords.IMPLEMENTS, ",", "&")) .withParent(PsiReferenceList.class)); static final ElementPattern IN_PERMITS_LIST = psiElement().afterLeaf( psiElement() - .withText(string().oneOf(PsiKeywords.PERMITS, ",")) - .withParent(psiElement(PsiReferenceList.class).withFirstChild(psiElement(PsiKeyword.class).withText(PsiKeywords.PERMITS)))); + .withText(string().oneOf(JavaKeywords.PERMITS, ",")) + .withParent(psiElement(PsiReferenceList.class).withFirstChild(psiElement(PsiKeyword.class).withText(JavaKeywords.PERMITS)))); private static final ElementPattern IN_VARIABLE_TYPE = psiElement() .withParents(PsiJavaCodeReferenceElement.class, PsiTypeElement.class, PsiDeclarationStatement.class) .afterLeaf(psiElement().inside(psiAnnotation())); @@ -207,7 +207,7 @@ public final class JavaCompletionContributor extends CompletionContributor imple return new OrFilter(ElementClassFilter.CLASS, ElementClassFilter.PACKAGE); } - if (psiElement().afterLeaf(PsiKeywords.INSTANCEOF).accepts(position) || + if (psiElement().afterLeaf(JavaKeywords.INSTANCEOF).accepts(position) || position.getParent() instanceof PsiJavaCodeReferenceElement ref && ref.getParent() instanceof PsiTypeElement typeElement && (typeElement.getParent() instanceof PsiPatternVariable || @@ -973,21 +973,21 @@ public final class JavaCompletionContributor extends CompletionContributor imple PsiCodeBlock block = PsiTreeUtil.getParentOfType(variable, PsiCodeBlock.class); PsiElement statement = block == null ? null : block.getParent(); if (statement instanceof PsiTryStatement) { - place = ((PsiTryStatement)statement).getFinallyBlock() == block ? PsiKeywords.TRY + "-" + PsiKeywords.FINALLY : PsiKeywords.TRY; + place = ((PsiTryStatement)statement).getFinallyBlock() == block ? JavaKeywords.TRY + "-" + JavaKeywords.FINALLY : JavaKeywords.TRY; } else if (statement instanceof PsiCatchSection) { - place = PsiKeywords.CATCH; + place = JavaKeywords.CATCH; } else if (statement instanceof PsiSynchronizedStatement) { - place = PsiKeywords.SYNCHRONIZED; + place = JavaKeywords.SYNCHRONIZED; } else if (statement instanceof PsiBlockStatement) { PsiElement parent = statement.getParent(); if (parent instanceof PsiWhileStatement) { - place = PsiKeywords.WHILE; + place = JavaKeywords.WHILE; } else if (parent instanceof PsiIfStatement) { - place = ((PsiIfStatement)parent).getThenBranch() == statement ? PsiKeywords.IF + "-then" : PsiKeywords.IF + "-" + PsiKeywords.ELSE; + place = ((PsiIfStatement)parent).getThenBranch() == statement ? JavaKeywords.IF + "-then" : JavaKeywords.IF + "-" + JavaKeywords.ELSE; } } return place; @@ -1085,9 +1085,9 @@ public final class JavaCompletionContributor extends CompletionContributor imple PsiAnnotationMemberValue defaultValue = ((PsiAnnotationMethod)method).getDefaultValue(); String defText = defaultValue == null ? null : defaultValue.getText(); - if (PsiKeywords.TRUE.equals(defText) || PsiKeywords.FALSE.equals(defText)) { + if (JavaKeywords.TRUE.equals(defText) || JavaKeywords.FALSE.equals(defText)) { result.addElement(createAnnotationAttributeElement(method, - PsiKeywords.TRUE.equals(defText) ? PsiKeywords.FALSE : PsiKeywords.TRUE, + JavaKeywords.TRUE.equals(defText) ? JavaKeywords.FALSE : JavaKeywords.TRUE, position)); result.addElement(PrioritizedLookupElement.withPriority(createAnnotationAttributeElement(method, defText, position) .withTailText(" (default)", true), -1)); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java index 72259aebbe79..278044d7f568 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionSorting.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.ExpectedTypeInfoImpl; import com.intellij.codeInsight.completion.impl.CompletionSorterImpl; import com.intellij.codeInsight.completion.impl.LiftShorterItemsClassifier; import com.intellij.codeInsight.lookup.*; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; @@ -250,8 +250,8 @@ public final class JavaCompletionSorting { if (hasNonVoid(expectedInfos)) { if (item.getObject() instanceof PsiKeyword) { String keyword = ((PsiKeyword)item.getObject()).getText(); - if (PsiKeywords.NEW.equals(keyword) && !(position.getParent() instanceof PsiMethodReferenceExpression) || - PsiKeywords.NULL.equals(keyword)) { + if (JavaKeywords.NEW.equals(keyword) && !(position.getParent() instanceof PsiMethodReferenceExpression) || + JavaKeywords.NULL.equals(keyword)) { return ExpectedTypeMatching.maybeExpected; } } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionStatistician.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionStatistician.java index 088985079a7f..acd6eae232e9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionStatistician.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaCompletionStatistician.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.ExpectedTypeInfoImpl; import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.patterns.ElementPattern; import com.intellij.psi.*; import com.intellij.psi.statistics.JavaStatisticsManager; @@ -18,7 +18,7 @@ import java.util.function.Function; import static com.intellij.patterns.PsiJavaPatterns.psiElement; public final class JavaCompletionStatistician extends CompletionStatistician{ - private static final ElementPattern SUPER_CALL = psiElement().afterLeaf(psiElement().withText(".").afterLeaf(PsiKeywords.SUPER)); + private static final ElementPattern SUPER_CALL = psiElement().afterLeaf(psiElement().withText(".").afterLeaf(JavaKeywords.SUPER)); @Override public @NotNull Function<@NotNull LookupElement, @Nullable StatisticsInfo> forLocation(@NotNull CompletionLocation location) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java index 5753ce8995e5..df67d3809024 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaConstructorCallElement.java @@ -6,7 +6,7 @@ import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementDecorator; import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.codeInsight.lookup.TypedLookupItem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.CaretModel; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.TextRange; @@ -57,7 +57,7 @@ public final class JavaConstructorCallElement extends LookupElementDecorator THROWS_TAG_EXCEPTION = psiElement().inside( psiElement(PsiDocTag.class).withName( - string().oneOf(PsiKeywords.THROWS, "exception"))); + string().oneOf(JavaKeywords.THROWS, "exception"))); private static final PsiElementPattern SNIPPET_ATTRIBUTE_NAME = psiElement(PsiDocToken.class) .withElementType(JavaDocTokenType.DOC_TAG_ATTRIBUTE_NAME).inside(psiElement(PsiSnippetAttribute.class)); diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaIncorrectElements.kt b/java/java-impl/src/com/intellij/codeInsight/completion/JavaIncorrectElements.kt index a280cdd8c227..50d08e35ac37 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaIncorrectElements.kt +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaIncorrectElements.kt @@ -4,7 +4,7 @@ package com.intellij.codeInsight.completion import com.intellij.codeInsight.AnnotationTargetUtil import com.intellij.codeInsight.ExceptionUtil import com.intellij.codeInsight.lookup.LookupElement -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.openapi.util.Key import com.intellij.openapi.util.UserDataHolder import com.intellij.patterns.ElementPattern @@ -154,7 +154,7 @@ private object ExceptionPositionMatcher: LookupPositionMatcher { private object ImplementsDeclarationPositionMatcher: LookupPositionMatcher { private val INSIDE_IMPLEMENTS_LIST: ElementPattern = PsiJavaPatterns.psiElement().afterLeaf( - PsiKeywords.IMPLEMENTS, ",").inside(PsiJavaPatterns.psiElement(JavaElementType.IMPLEMENTS_LIST)) + JavaKeywords.IMPLEMENTS, ",").inside(PsiJavaPatterns.psiElement(JavaElementType.IMPLEMENTS_LIST)) override fun match(position: PsiElement): Boolean { return INSIDE_IMPLEMENTS_LIST.accepts(position) @@ -172,7 +172,7 @@ private object ImplementsDeclarationPositionMatcher: LookupPositionMatcher { private object ExtendsDeclarationPositionMatcher: LookupPositionMatcher { private val EXTENDS_LIST: ElementPattern = PsiJavaPatterns.psiElement().afterLeaf( - PsiKeywords.EXTENDS, ",").inside(PsiJavaPatterns.psiElement(JavaElementType.EXTENDS_LIST)) + JavaKeywords.EXTENDS, ",").inside(PsiJavaPatterns.psiElement(JavaElementType.EXTENDS_LIST)) override fun match(position: PsiElement): Boolean { return EXTENDS_LIST.accepts(position) diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java index 7fcc5ed897d9..3167922387fc 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaInheritorsGetter.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.CodeInsightUtil; import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.lookup.*; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.*; @@ -108,7 +108,7 @@ public class JavaInheritorsGetter { PsiElement position = parameters.getPosition(); if ((parameters.getInvocationCount() < 2 || psiClass instanceof PsiCompiledElement) && isInnerClassFromStaticContext(position, psiClass) && - !psiElement().afterLeaf(psiElement().withText(PsiKeywords.NEW).afterLeaf(".")).accepts(position)) { + !psiElement().afterLeaf(psiElement().withText(JavaKeywords.NEW).afterLeaf(".")).accepts(position)) { return null; } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java index 5308ba86300c..720dd37d7317 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java @@ -8,7 +8,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.CreateClassKind; import com.intellij.codeInsight.lookup.*; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.java.codeserver.core.JavaPsiSwitchUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.CaretModel; import com.intellij.openapi.editor.Document; import com.intellij.openapi.util.Conditions; @@ -48,7 +48,7 @@ public class JavaKeywordCompletion { public static final ElementPattern AFTER_DOT = psiElement().afterLeaf("."); static final ElementPattern VARIABLE_AFTER_FINAL = - psiElement().afterLeaf(PsiKeywords.FINAL).inside(PsiDeclarationStatement.class); + psiElement().afterLeaf(JavaKeywords.FINAL).inside(PsiDeclarationStatement.class); private static final ElementPattern INSIDE_PARAMETER_LIST = psiElement().withParent( @@ -108,17 +108,17 @@ public class JavaKeywordCompletion { private static final ElementPattern SUPER_OR_THIS_PATTERN = and(JavaSmartCompletionContributor.INSIDE_EXPRESSION, - not(psiElement().afterLeaf(PsiKeywords.CASE)), - not(psiElement().afterLeaf(psiElement().withText(".").afterLeaf(PsiKeywords.THIS, PsiKeywords.SUPER))), + not(psiElement().afterLeaf(JavaKeywords.CASE)), + not(psiElement().afterLeaf(psiElement().withText(".").afterLeaf(JavaKeywords.THIS, JavaKeywords.SUPER))), not(psiElement().inside(PsiAnnotation.class)), not(START_SWITCH), not(JavaMemberNameCompletionContributor.INSIDE_TYPE_PARAMS_PATTERN)); static final Set PRIMITIVE_TYPES = ContainerUtil.newLinkedHashSet( - PsiKeywords.SHORT, PsiKeywords.BOOLEAN, - PsiKeywords.DOUBLE, PsiKeywords.LONG, - PsiKeywords.INT, PsiKeywords.FLOAT, - PsiKeywords.CHAR, PsiKeywords.BYTE + JavaKeywords.SHORT, JavaKeywords.BOOLEAN, + JavaKeywords.DOUBLE, JavaKeywords.LONG, + JavaKeywords.INT, JavaKeywords.FLOAT, + JavaKeywords.CHAR, JavaKeywords.BYTE ); static final PsiElementPattern START_FOR = psiElement().afterLeaf(psiElement().withText("(").afterLeaf("for")); @@ -202,8 +202,8 @@ public class JavaKeywordCompletion { .withText("}") .withParent(psiElement(PsiCodeBlock.class).withParent(or(psiElement(PsiTryStatement.class), psiElement(PsiCatchSection.class)))) .accepts(myPrevLeaf)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.CATCH), JavaTailTypes.CATCH_LPARENTH)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.FINALLY), JavaTailTypes.FINALLY_LBRACE)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.CATCH), JavaTailTypes.CATCH_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.FINALLY), JavaTailTypes.FINALLY_LBRACE)); List elements = CatchLookupElement.create(myPrevLeaf); for (LookupElement element : elements) { addKeyword(element); @@ -213,18 +213,18 @@ public class JavaKeywordCompletion { } } - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.SWITCH), JavaTailTypes.SWITCH_LPARENTH)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.WHILE), JavaTailTypes.WHILE_LPARENTH)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.DO), JavaTailTypes.DO_LBRACE)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.FOR), JavaTailTypes.FOR_LPARENTH)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.IF), JavaTailTypes.IF_LPARENTH)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.TRY), JavaTailTypes.TRY_LBRACE)); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.THROW), TailTypes.insertSpaceType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.NEW), TailTypes.insertSpaceType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.SYNCHRONIZED), JavaTailTypes.SYNCHRONIZED_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.SWITCH), JavaTailTypes.SWITCH_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.WHILE), JavaTailTypes.WHILE_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.DO), JavaTailTypes.DO_LBRACE)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.FOR), JavaTailTypes.FOR_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.IF), JavaTailTypes.IF_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.TRY), JavaTailTypes.TRY_LBRACE)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.THROW), TailTypes.insertSpaceType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.NEW), TailTypes.insertSpaceType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.SYNCHRONIZED), JavaTailTypes.SYNCHRONIZED_LPARENTH)); if (PsiUtil.isAvailable(JavaFeature.ASSERTIONS, myPosition)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.ASSERT), TailTypes.insertSpaceType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.ASSERT), TailTypes.insertSpaceType())); } if (!psiElement().inside(PsiSwitchExpression.class).accepts(myPosition) || @@ -234,15 +234,15 @@ public class JavaKeywordCompletion { if (psiElement().withText(";").withSuperParent(2, PsiIfStatement.class).accepts(myPrevLeaf) || psiElement().withText("}").withSuperParent(3, PsiIfStatement.class).accepts(myPrevLeaf)) { - LookupElement elseKeyword = new OverridableSpace(createKeyword(PsiKeywords.ELSE), TailTypes.humbleSpaceBeforeWordType()); + LookupElement elseKeyword = new OverridableSpace(createKeyword(JavaKeywords.ELSE), TailTypes.humbleSpaceBeforeWordType()); CharSequence text = myParameters.getEditor().getDocument().getCharsSequence(); int offset = myParameters.getOffset(); while (text.length() > offset && Character.isWhitespace(text.charAt(offset))) { offset++; } - if (text.length() > offset + PsiKeywords.ELSE.length() && - text.subSequence(offset, offset + PsiKeywords.ELSE.length()).toString().equals(PsiKeywords.ELSE) && - Character.isWhitespace(text.charAt(offset + PsiKeywords.ELSE.length()))) { + if (text.length() > offset + JavaKeywords.ELSE.length() && + text.subSequence(offset, offset + JavaKeywords.ELSE.length()).toString().equals(JavaKeywords.ELSE) && + Character.isWhitespace(text.charAt(offset + JavaKeywords.ELSE.length()))) { elseKeyword = PrioritizedLookupElement.withPriority(elseKeyword, -1); } addKeyword(elseKeyword); @@ -251,7 +251,7 @@ public class JavaKeywordCompletion { private @NotNull LookupElement createReturnKeyword() { TailType returnTail = getReturnTail(myPosition); - LookupElement ret = createKeyword(PsiKeywords.RETURN); + LookupElement ret = createKeyword(JavaKeywords.RETURN); if (returnTail != TailTypes.noneType()) { ret = new OverridableSpace(ret, returnTail); } @@ -351,7 +351,7 @@ public class JavaKeywordCompletion { } final OverridableSpace defaultCaseRule = - new OverridableSpace(createKeyword(PsiKeywords.DEFAULT), JavaTailTypes.forSwitchLabel(switchBlock)); + new OverridableSpace(createKeyword(JavaKeywords.DEFAULT), JavaTailTypes.forSwitchLabel(switchBlock)); addKeyword(prioritizeForRule(LookupElementDecorator.withInsertHandler(defaultCaseRule, ADJUST_LINE_OFFSET), switchBlock)); } @@ -392,22 +392,22 @@ public class JavaKeywordCompletion { if (!(parentOfPattern instanceof PsiCaseLabelElementList)) { return; } - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.WHEN), TailTypes.insertSpaceType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.WHEN), TailTypes.insertSpaceType())); } private void addSwitchRuleKeywords(@NotNull PsiSwitchLabeledRuleStatement rule) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.THROW), TailTypes.insertSpaceType())); - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.ASSERT), TailTypes.insertSpaceType()))); - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.WHILE), JavaTailTypes.WHILE_LPARENTH))); - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.DO), JavaTailTypes.DO_LBRACE))); - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.FOR), JavaTailTypes.FOR_LPARENTH))); - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.IF), JavaTailTypes.IF_LPARENTH))); - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.TRY), JavaTailTypes.TRY_LBRACE))); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.THROW), TailTypes.insertSpaceType())); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.ASSERT), TailTypes.insertSpaceType()))); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.WHILE), JavaTailTypes.WHILE_LPARENTH))); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.DO), JavaTailTypes.DO_LBRACE))); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.FOR), JavaTailTypes.FOR_LPARENTH))); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.IF), JavaTailTypes.IF_LPARENTH))); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.TRY), JavaTailTypes.TRY_LBRACE))); if (rule.getEnclosingSwitchBlock() instanceof PsiSwitchStatement) { addKeyword(wrapRuleIntoBlock(createReturnKeyword())); } else { - addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(PsiKeywords.YIELD), TailTypes.insertSpaceType()))); + addKeyword(wrapRuleIntoBlock(new OverridableSpace(createKeyword(JavaKeywords.YIELD), TailTypes.insertSpaceType()))); } } @@ -458,7 +458,7 @@ public class JavaKeywordCompletion { final PsiType selectorType = getSelectorType(switchBlock); if (selectorType instanceof PsiPrimitiveType) return; - addKeyword(createKeyword(PsiKeywords.NULL)); + addKeyword(createKeyword(JavaKeywords.NULL)); } private boolean isInsideCaseLabel() { @@ -468,7 +468,7 @@ public class JavaKeywordCompletion { private void addVar() { if (isVarAllowed()) { - addKeyword(createKeyword(PsiKeywords.VAR)); + addKeyword(createKeyword(JavaKeywords.VAR)); } } @@ -500,7 +500,7 @@ public class JavaKeywordCompletion { boolean addWildcardExtendsSuper(CompletionResultSet result, PsiElement position) { if (JavaMemberNameCompletionContributor.INSIDE_TYPE_PARAMS_PATTERN.accepts(position)) { - for (String keyword : ContainerUtil.ar(PsiKeywords.EXTENDS, PsiKeywords.SUPER)) { + for (String keyword : ContainerUtil.ar(JavaKeywords.EXTENDS, JavaKeywords.SUPER)) { if (myKeywordMatcher.isStartMatch(keyword)) { LookupElement item = BasicExpressionCompletionContributor.createKeywordLookupItem(position, keyword); result.addElement(new OverridableSpace(item, TailTypes.humbleSpaceBeforeWordType())); @@ -515,10 +515,10 @@ public class JavaKeywordCompletion { if (psiElement().withText(")").withParents(PsiParameterList.class, PsiMethod.class).accepts(myPrevLeaf)) { assert myPrevLeaf != null; if (myPrevLeaf.getParent().getParent() instanceof PsiAnnotationMethod) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.DEFAULT), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.DEFAULT), TailTypes.humbleSpaceBeforeWordType())); } else { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.THROWS), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.THROWS), TailTypes.humbleSpaceBeforeWordType())); } } } @@ -528,12 +528,12 @@ public class JavaKeywordCompletion { if (switchBlock == null) return; PsiElement defaultElement = JavaPsiSwitchUtil.findDefaultElement(switchBlock); if (defaultElement != null && defaultElement.getTextRange().getStartOffset() < myPosition.getTextRange().getStartOffset()) return; - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.CASE), TailTypes.insertSpaceType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.CASE), TailTypes.insertSpaceType())); if (defaultElement != null) { return; } final OverridableSpace defaultCaseRule = - new OverridableSpace(createKeyword(PsiKeywords.DEFAULT), JavaTailTypes.forSwitchLabel(switchBlock)); + new OverridableSpace(createKeyword(JavaKeywords.DEFAULT), JavaTailTypes.forSwitchLabel(switchBlock)); addKeyword(prioritizeForRule(LookupElementDecorator.withInsertHandler(defaultCaseRule, ADJUST_LINE_OFFSET), switchBlock)); } @@ -551,10 +551,10 @@ public class JavaKeywordCompletion { final TailType caseRuleTail = JavaTailTypes.forSwitchLabel(switchBlock); Set containedLabels = getSwitchCoveredLabels(switchBlock, myPosition); - if (!containedLabels.contains(PsiKeywords.NULL)) { - addKeyword(createCaseRule(PsiKeywords.NULL, caseRuleTail, switchBlock)); - if (!containedLabels.contains(PsiKeywords.DEFAULT)) { - addKeyword(createCaseRule(PsiKeywords.NULL + ", " + PsiKeywords.DEFAULT, caseRuleTail, switchBlock)); + if (!containedLabels.contains(JavaKeywords.NULL)) { + addKeyword(createCaseRule(JavaKeywords.NULL, caseRuleTail, switchBlock)); + if (!containedLabels.contains(JavaKeywords.DEFAULT)) { + addKeyword(createCaseRule(JavaKeywords.NULL + ", " + JavaKeywords.DEFAULT, caseRuleTail, switchBlock)); } } addSealedHierarchyCases(selectorType, containedLabels); @@ -573,7 +573,7 @@ public class JavaKeywordCompletion { for (PsiStatement statement : body.getStatements()) { if (!(statement instanceof PsiSwitchLabelStatementBase labelStatement)) continue; if (labelStatement.isDefaultCase()) { - labels.add(PsiKeywords.DEFAULT); + labels.add(JavaKeywords.DEFAULT); continue; } if (labelStatement.getGuardExpression() != null) { @@ -586,11 +586,11 @@ public class JavaKeywordCompletion { for (PsiCaseLabelElement element : list.getElements()) { if (element instanceof PsiExpression expr && ExpressionUtils.isNullLiteral(expr)) { - labels.add(PsiKeywords.NULL); + labels.add(JavaKeywords.NULL); continue; } if (element instanceof PsiDefaultCaseLabelElement) { - labels.add(PsiKeywords.DEFAULT); + labels.add(JavaKeywords.DEFAULT); } if (element.getTextRange().getStartOffset() >= offset) { break; @@ -718,7 +718,7 @@ public class JavaKeywordCompletion { if (tryStatement == null || tryStatement.getCatchSections().length > 0 || tryStatement.getFinallyBlock() != null || tryStatement.getResourceList() != null) { - LookupElement finalKeyword = new OverridableSpace(createKeyword(PsiKeywords.FINAL), TailTypes.humbleSpaceBeforeWordType()); + LookupElement finalKeyword = new OverridableSpace(createKeyword(JavaKeywords.FINAL), TailTypes.humbleSpaceBeforeWordType()); if (statement.getParent() instanceof PsiSwitchLabeledRuleStatement) { finalKeyword = wrapRuleIntoBlock(finalKeyword); } @@ -729,9 +729,9 @@ public class JavaKeywordCompletion { } if ((isInsideParameterList(myPosition) || isAtCatchOrResourceVariableStart(myPosition)) && - !psiElement().afterLeaf(PsiKeywords.FINAL).accepts(myPosition) && + !psiElement().afterLeaf(JavaKeywords.FINAL).accepts(myPosition) && !AFTER_DOT.accepts(myPosition)) { - addKeyword(TailTypeDecorator.withTail(createKeyword(PsiKeywords.FINAL), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(TailTypeDecorator.withTail(createKeyword(JavaKeywords.FINAL), TailTypes.humbleSpaceBeforeWordType())); } } @@ -742,10 +742,10 @@ public class JavaKeywordCompletion { final boolean insideInheritorClass = PsiUtil.isAvailable(JavaFeature.EXTENSION_METHODS, myPosition) && isInsideInheritorClass(); if (!afterDot || insideQualifierClass || insideInheritorClass) { if (!afterDot || insideQualifierClass) { - addKeyword(createKeyword(PsiKeywords.THIS)); + addKeyword(createKeyword(JavaKeywords.THIS)); } - final LookupElement superItem = createKeyword(PsiKeywords.SUPER); + final LookupElement superItem = createKeyword(JavaKeywords.SUPER); if (psiElement().afterLeaf(psiElement().withText("{").withSuperParent(2, psiMethod().constructor(true))).accepts(myPosition)) { final PsiMethod method = PsiTreeUtil.getParentOfType(myPosition, PsiMethod.class, false, PsiClass.class); assert method != null; @@ -777,23 +777,23 @@ public class JavaKeywordCompletion { boolean allowExprKeywords = !(grandParent instanceof PsiExpressionStatement) && !(grandParent instanceof PsiUnaryExpression); if (PsiTreeUtil.getParentOfType(myPosition, PsiAnnotation.class) == null) { if (!statementPosition) { - addKeyword(TailTypeDecorator.withTail(createKeyword(PsiKeywords.NEW), TailTypes.insertSpaceType())); + addKeyword(TailTypeDecorator.withTail(createKeyword(JavaKeywords.NEW), TailTypes.insertSpaceType())); if (PsiUtil.isAvailable(JavaFeature.ENHANCED_SWITCH, myPosition)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.SWITCH), JavaTailTypes.SWITCH_LPARENTH)); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.SWITCH), JavaTailTypes.SWITCH_LPARENTH)); } } if (allowExprKeywords) { - addKeyword(createKeyword(PsiKeywords.NULL)); + addKeyword(createKeyword(JavaKeywords.NULL)); } } if (allowExprKeywords && mayExpectBoolean(myParameters)) { - addKeyword(createKeyword(PsiKeywords.TRUE)); - addKeyword(createKeyword(PsiKeywords.FALSE)); + addKeyword(createKeyword(JavaKeywords.TRUE)); + addKeyword(createKeyword(JavaKeywords.FALSE)); } } if (isQualifiedNewContext()) { - addKeyword(createKeyword(PsiKeywords.NEW)); + addKeyword(createKeyword(JavaKeywords.NEW)); } } @@ -829,31 +829,31 @@ public class JavaKeywordCompletion { if (myPrevLeaf == null || bogusDeclarationInImplicitClass && file instanceof PsiJavaFile javaFile && javaFile.getPackageStatement() == null && javaFile.getImportList() != null && javaFile.getImportList().getAllImportStatements().length == 0) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.PACKAGE), TailTypes.humbleSpaceBeforeWordType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.PACKAGE), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); } else if (psiElement().inside(psiAnnotation().withParents(PsiModifierList.class, PsiFile.class)).accepts(myPrevLeaf) && PsiPackage.PACKAGE_INFO_FILE.equals(file.getName())) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.PACKAGE), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.PACKAGE), TailTypes.humbleSpaceBeforeWordType())); } else if (isEndOfBlock(myPosition) && (parentMember == null || bogusDeclarationInImplicitClass)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); } } - if (PsiUtil.isAvailable(JavaFeature.STATIC_IMPORTS, file) && myPrevLeaf != null && myPrevLeaf.textMatches(PsiKeywords.IMPORT)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.STATIC), TailTypes.humbleSpaceBeforeWordType())); + if (PsiUtil.isAvailable(JavaFeature.STATIC_IMPORTS, file) && myPrevLeaf != null && myPrevLeaf.textMatches(JavaKeywords.IMPORT)) { + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.STATIC), TailTypes.humbleSpaceBeforeWordType())); } - if (PsiUtil.isAvailable(JavaFeature.MODULE_IMPORT_DECLARATIONS, file) && myPrevLeaf != null && myPrevLeaf.textMatches(PsiKeywords.IMPORT)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.MODULE), TailTypes.humbleSpaceBeforeWordType())); + if (PsiUtil.isAvailable(JavaFeature.MODULE_IMPORT_DECLARATIONS, file) && myPrevLeaf != null && myPrevLeaf.textMatches(JavaKeywords.IMPORT)) { + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.MODULE), TailTypes.humbleSpaceBeforeWordType())); } } private void addInstanceof() { if (isInstanceofPlace(myPosition)) { addKeyword(LookupElementDecorator.withInsertHandler( - createKeyword(PsiKeywords.INSTANCEOF), + createKeyword(JavaKeywords.INSTANCEOF), (context, item) -> { TailType tailType = TailTypes.humbleSpaceBeforeWordType(); if (tailType.isApplicable(context)) { @@ -894,28 +894,28 @@ public class JavaKeywordCompletion { } if (psiElement().insideStarting(psiElement(PsiLocalVariable.class, PsiExpressionStatement.class)).accepts(myPosition)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.CLASS), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.CLASS), TailTypes.humbleSpaceBeforeWordType())); addKeyword(new OverridableSpace(LookupElementBuilder.create("abstract class").bold(), TailTypes.humbleSpaceBeforeWordType())); if (PsiUtil.isAvailable(JavaFeature.RECORDS, myPosition)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.RECORD), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.RECORD), TailTypes.humbleSpaceBeforeWordType())); } if (PsiUtil.isAvailable(JavaFeature.LOCAL_ENUMS, myPosition)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.ENUM), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.ENUM), TailTypes.humbleSpaceBeforeWordType())); } if (PsiUtil.isAvailable(JavaFeature.LOCAL_INTERFACES, myPosition)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.INTERFACE), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.INTERFACE), TailTypes.humbleSpaceBeforeWordType())); } } if (PsiTreeUtil.getParentOfType(myPosition, PsiExpression.class, true, PsiMember.class) == null && PsiTreeUtil.getParentOfType(myPosition, PsiCodeBlock.class, true, PsiMember.class) == null) { List keywords = new ArrayList<>(); - keywords.add(PsiKeywords.CLASS); - keywords.add(PsiKeywords.INTERFACE); + keywords.add(JavaKeywords.CLASS); + keywords.add(JavaKeywords.INTERFACE); if (PsiUtil.isAvailable(JavaFeature.RECORDS, myPosition)) { - keywords.add(PsiKeywords.RECORD); + keywords.add(JavaKeywords.RECORD); } if (PsiUtil.isAvailable(JavaFeature.ENUMS, myPosition)) { - keywords.add(PsiKeywords.ENUM); + keywords.add(JavaKeywords.ENUM); } String className = recommendClassName(); for (String keyword : keywords) { @@ -931,7 +931,7 @@ public class JavaKeywordCompletion { if (psiElement().withText("@").andNot(psiElement().inside(PsiParameterList.class)).andNot(psiElement().inside(psiNameValuePair())) .accepts(myPrevLeaf)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.INTERFACE), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.INTERFACE), TailTypes.humbleSpaceBeforeWordType())); } } @@ -960,7 +960,7 @@ public class JavaKeywordCompletion { Document document = context.getDocument(); int offset = context.getTailOffset(); String suffix = " "; - if (keyword.equals(PsiKeywords.RECORD)) { + if (keyword.equals(JavaKeywords.RECORD)) { if (JavaTokenType.LPARENTH.equals(nextToken)) { suffix = ""; } @@ -985,7 +985,7 @@ public class JavaKeywordCompletion { private @Nullable String recommendClassName() { if (myPrevLeaf == null) return null; - if (!myPrevLeaf.textMatches(PsiKeywords.PUBLIC) || !(myPrevLeaf.getParent() instanceof PsiModifierList)) return null; + if (!myPrevLeaf.textMatches(JavaKeywords.PUBLIC) || !(myPrevLeaf.getParent() instanceof PsiModifierList)) return null; if (nextIsIdentifier(myPosition)) return null; @@ -1026,7 +1026,7 @@ public class JavaKeywordCompletion { private void addClassLiteral() { if (isAfterTypeDot(myPosition)) { - addKeyword(createKeyword(PsiKeywords.CLASS)); + addKeyword(createKeyword(JavaKeywords.CLASS)); } } @@ -1054,7 +1054,7 @@ public class JavaKeywordCompletion { if (psiClass != null) { if (!psiClass.isEnum() && !psiClass.isRecord()) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.EXTENDS), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.EXTENDS), TailTypes.humbleSpaceBeforeWordType())); if (PsiUtil.isAvailable(JavaFeature.SEALED_CLASSES, psiClass)) { PsiModifierList modifiers = psiClass.getModifierList(); if (myParameters.getInvocationCount() > 1 || @@ -1071,14 +1071,14 @@ public class JavaKeywordCompletion { } }; LookupElement element = - new OverridableSpace(LookupElementDecorator.withInsertHandler(createKeyword(PsiKeywords.PERMITS), handler), + new OverridableSpace(LookupElementDecorator.withInsertHandler(createKeyword(JavaKeywords.PERMITS), handler), TailTypes.humbleSpaceBeforeWordType()); addKeyword(element); } } } if (!psiClass.isInterface() && !(psiClass instanceof PsiTypeParameter)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.IMPLEMENTS), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.IMPLEMENTS), TailTypes.humbleSpaceBeforeWordType())); } } } @@ -1159,7 +1159,7 @@ public class JavaKeywordCompletion { return psiElement().withParent( psiReferenceExpression().withFirstChild( psiElement(PsiClassObjectAccessExpression.class).withLastChild( - not(psiElement().withText(PsiKeywords.CLASS))))).accepts(element); + not(psiElement().withText(JavaKeywords.CLASS))))).accepts(element); } static boolean isAfterTypeDot(PsiElement position) { @@ -1204,7 +1204,7 @@ public class JavaKeywordCompletion { .map(branch -> branch.toString()) .collect(Collectors.toSet()); TailType tailType = JavaTailTypes.forSwitchLabel(switchBlock); - for (String keyword : List.of(PsiKeywords.TRUE, PsiKeywords.FALSE)) { + for (String keyword : List.of(JavaKeywords.TRUE, JavaKeywords.FALSE)) { if(branches.contains(keyword)) continue; result.accept(new JavaKeywordCompletion.OverridableSpace( BasicExpressionCompletionContributor.createKeywordLookupItem(position, keyword), tailType)); @@ -1250,16 +1250,16 @@ public class JavaKeywordCompletion { result.consume(BasicExpressionCompletionContributor.createKeywordLookupItem(position, primitiveType)); } } - if (expressionPosition && !session.isKeywordAlreadyProcessed(PsiKeywords.VOID)) { - result.consume(BasicExpressionCompletionContributor.createKeywordLookupItem(position, PsiKeywords.VOID)); + if (expressionPosition && !session.isKeywordAlreadyProcessed(JavaKeywords.VOID)) { + result.consume(BasicExpressionCompletionContributor.createKeywordLookupItem(position, JavaKeywords.VOID)); } } if (declaration) { - LookupElement item = BasicExpressionCompletionContributor.createKeywordLookupItem(position, PsiKeywords.VOID); + LookupElement item = BasicExpressionCompletionContributor.createKeywordLookupItem(position, JavaKeywords.VOID); result.consume(new OverridableSpace(item, TailTypes.humbleSpaceBeforeWordType())); } else if (typeFragment && ((PsiTypeCodeFragment)position.getContainingFile()).isVoidValid()) { - result.consume(BasicExpressionCompletionContributor.createKeywordLookupItem(position, PsiKeywords.VOID)); + result.consume(BasicExpressionCompletionContributor.createKeywordLookupItem(position, JavaKeywords.VOID)); } } @@ -1293,7 +1293,7 @@ public class JavaKeywordCompletion { */ private static boolean afterCaseForType(@Nullable PsiElement position) { if (position == null) return false; - return psiElement().afterLeaf(PsiKeywords.CASE).accepts(position) && + return psiElement().afterLeaf(JavaKeywords.CASE).accepts(position) && ((position.getParent() instanceof PsiReferenceExpression referenceExpression && referenceExpression.getParent() instanceof PsiCaseLabelElementList) || (position.getParent() instanceof PsiJavaCodeReferenceElement referenceElement && @@ -1368,8 +1368,8 @@ public class JavaKeywordCompletion { PsiLoopStatement loop = PsiTreeUtil.getParentOfType(myPosition, PsiLoopStatement.class, true, PsiLambdaExpression.class, PsiMember.class); - LookupElement br = createKeyword(PsiKeywords.BREAK); - LookupElement cont = createKeyword(PsiKeywords.CONTINUE); + LookupElement br = createKeyword(JavaKeywords.BREAK); + LookupElement cont = createKeyword(JavaKeywords.CONTINUE); TailType tailType; if (psiElement().insideSequence(true, psiElement(PsiLabeledStatement.class), or(psiElement(PsiFile.class), psiElement(PsiMethod.class), @@ -1391,7 +1391,7 @@ public class JavaKeywordCompletion { } else if (psiElement().inside(PsiSwitchExpression.class).accepts(myPosition) && PsiUtil.isAvailable(JavaFeature.SWITCH_EXPRESSION, myPosition)) { - addKeyword(TailTypeDecorator.withTail(createKeyword(PsiKeywords.YIELD), TailTypes.insertSpaceType())); + addKeyword(TailTypeDecorator.withTail(createKeyword(JavaKeywords.YIELD), TailTypes.insertSpaceType())); } for (PsiLabeledStatement labeled : psiApi().parents(myPosition).takeWhile(notInstanceOf(PsiMember.class)) @@ -1497,43 +1497,43 @@ public class JavaKeywordCompletion { PsiElement prevElement = PsiTreeUtil.skipWhitespacesAndCommentsBackward(myPosition.getParent()); if (context instanceof PsiField && context.getParent() instanceof PsiImplicitClass) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.MODULE), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.MODULE), TailTypes.humbleSpaceBeforeWordType())); if (prevElement == null) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); } } if (context instanceof PsiJavaFile && !(prevElement instanceof PsiJavaModule) || context instanceof PsiImportList) { if (myPrevLeaf == null || PsiUtil.isJavaToken(myPrevLeaf, JavaTokenType.SEMICOLON)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.IMPORT), TailTypes.humbleSpaceBeforeWordType())); } - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.MODULE), TailTypes.humbleSpaceBeforeWordType())); - if (myPrevLeaf == null || !myPrevLeaf.textMatches(PsiKeywords.OPEN)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.OPEN), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.MODULE), TailTypes.humbleSpaceBeforeWordType())); + if (myPrevLeaf == null || !myPrevLeaf.textMatches(JavaKeywords.OPEN)) { + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.OPEN), TailTypes.humbleSpaceBeforeWordType())); } } else if (context instanceof PsiJavaModule) { if (prevElement instanceof PsiPackageAccessibilityStatement && !myPrevLeaf.textMatches(";")) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.TO), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.TO), TailTypes.humbleSpaceBeforeWordType())); } else if (!PsiUtil.isJavaToken(prevElement, JavaTokenType.MODULE_KEYWORD)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.REQUIRES), TailTypes.humbleSpaceBeforeWordType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.EXPORTS), TailTypes.humbleSpaceBeforeWordType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.OPENS), TailTypes.humbleSpaceBeforeWordType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.USES), TailTypes.humbleSpaceBeforeWordType())); - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.PROVIDES), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.REQUIRES), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.EXPORTS), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.OPENS), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.USES), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.PROVIDES), TailTypes.humbleSpaceBeforeWordType())); } } else if (context instanceof PsiRequiresStatement) { - if (!myPrevLeaf.textMatches(PsiKeywords.TRANSITIVE)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.TRANSITIVE), TailTypes.humbleSpaceBeforeWordType())); + if (!myPrevLeaf.textMatches(JavaKeywords.TRANSITIVE)) { + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.TRANSITIVE), TailTypes.humbleSpaceBeforeWordType())); } - if (!myPrevLeaf.textMatches(PsiKeywords.STATIC)) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.STATIC), TailTypes.humbleSpaceBeforeWordType())); + if (!myPrevLeaf.textMatches(JavaKeywords.STATIC)) { + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.STATIC), TailTypes.humbleSpaceBeforeWordType())); } } else if (context instanceof PsiProvidesStatement && prevElement instanceof PsiJavaCodeReferenceElement) { - addKeyword(new OverridableSpace(createKeyword(PsiKeywords.WITH), TailTypes.humbleSpaceBeforeWordType())); + addKeyword(new OverridableSpace(createKeyword(JavaKeywords.WITH), TailTypes.humbleSpaceBeforeWordType())); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java index c7154b6e2bf5..6c1621c06a91 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaNoVariantsDelegator.java @@ -10,7 +10,7 @@ import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor; import com.intellij.codeInsight.lookup.AutoCompletionPolicy; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.TailTypeDecorator; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; @@ -77,7 +77,7 @@ public final class JavaNoVariantsDelegator extends CompletionContributor impleme ExpectedTypeInfo[] infos = JavaSmartCompletionContributor.getExpectedTypes(parameters); for (ExpectedTypeInfo info : infos) { if (!(info.getType() instanceof PsiPrimitiveType)) { - LookupElement item = BasicExpressionCompletionContributor.createKeywordLookupItem(parameters.getPosition(), PsiKeywords.NULL); + LookupElement item = BasicExpressionCompletionContributor.createKeywordLookupItem(parameters.getPosition(), JavaKeywords.NULL); result.addElement(JavaSmartCompletionContributor.decorate(item, ContainerUtil.newHashSet(infos))); return; } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java index 6c30dbc83388..173beb0c28ec 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaSmartCompletionContributor.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.*; import com.intellij.codeInsight.completion.scope.JavaCompletionProcessor; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementDecorator; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.patterns.ElementPattern; import com.intellij.psi.*; import com.intellij.psi.filters.ElementExtractorFilter; @@ -52,9 +52,9 @@ public final class JavaSmartCompletionContributor { }; private static final ElementExtractorFilter THROWABLES_FILTER = new ElementExtractorFilter(new AssignableFromFilter(CommonClassNames.JAVA_LANG_THROWABLE)); - static final ElementPattern AFTER_NEW = psiElement().afterLeaf(psiElement().withText(PsiKeywords.NEW)); - static final ElementPattern AFTER_THROW_NEW = psiElement().afterLeaf(psiElement().withText(PsiKeywords.NEW).afterLeaf( - PsiKeywords.THROW)); + static final ElementPattern AFTER_NEW = psiElement().afterLeaf(psiElement().withText(JavaKeywords.NEW)); + static final ElementPattern AFTER_THROW_NEW = psiElement().afterLeaf(psiElement().withText(JavaKeywords.NEW).afterLeaf( + JavaKeywords.THROW)); public static final ElementPattern INSIDE_EXPRESSION = or( psiElement().withParent(PsiExpression.class) .andNot(psiElement().withParent(PsiLiteralExpression.class)) diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ModifierChooser.java b/java/java-impl/src/com/intellij/codeInsight/completion/ModifierChooser.java index 17ef8ed0ed5e..f165a233ab86 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/ModifierChooser.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/ModifierChooser.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.completion; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.*; import com.intellij.psi.filters.FilterPositionUtil; @@ -35,40 +35,40 @@ public final class ModifierChooser { } private static final ArrayOfModifiers[] CLASS_MODIFIERS = { - new ArrayOfModifiers(new String[]{PsiKeywords.PUBLIC}), - new ArrayOfModifiers(new String[]{PsiKeywords.FINAL, PsiKeywords.ABSTRACT}) + new ArrayOfModifiers(new String[]{JavaKeywords.PUBLIC}), + new ArrayOfModifiers(new String[]{JavaKeywords.FINAL, JavaKeywords.ABSTRACT}) }; private static final String[] CLASS_MODIFIERS_WITH_SEALED = { - PsiKeywords.PUBLIC, PsiKeywords.FINAL, PsiKeywords.SEALED, PsiKeywords.NON_SEALED, PsiKeywords.ABSTRACT + JavaKeywords.PUBLIC, JavaKeywords.FINAL, JavaKeywords.SEALED, JavaKeywords.NON_SEALED, JavaKeywords.ABSTRACT }; private static final ArrayOfModifiers[] CLASS_MEMBER_MODIFIERS = { - new ArrayOfModifiers(new String[]{PsiKeywords.PUBLIC, PsiKeywords.PROTECTED, PsiKeywords.PRIVATE}), - new ArrayOfModifiers(new String[]{PsiKeywords.STATIC}), - new ArrayOfModifiers(new String[]{PsiKeywords.FINAL, PsiKeywords.ABSTRACT}), - new ArrayOfModifiers(new String[]{PsiKeywords.SEALED, PsiKeywords.NON_SEALED}, JavaFeature.SEALED_CLASSES), - new ArrayOfModifiers(new String[]{PsiKeywords.NATIVE}), - new ArrayOfModifiers(new String[]{PsiKeywords.SYNCHRONIZED}), - new ArrayOfModifiers(new String[]{PsiKeywords.STRICTFP}, el -> !PsiUtil.isAvailable(JavaFeature.ALWAYS_STRICTFP, el)), - new ArrayOfModifiers(new String[]{PsiKeywords.VOLATILE}), - new ArrayOfModifiers(new String[]{PsiKeywords.TRANSIENT}) + new ArrayOfModifiers(new String[]{JavaKeywords.PUBLIC, JavaKeywords.PROTECTED, JavaKeywords.PRIVATE}), + new ArrayOfModifiers(new String[]{JavaKeywords.STATIC}), + new ArrayOfModifiers(new String[]{JavaKeywords.FINAL, JavaKeywords.ABSTRACT}), + new ArrayOfModifiers(new String[]{JavaKeywords.SEALED, JavaKeywords.NON_SEALED}, JavaFeature.SEALED_CLASSES), + new ArrayOfModifiers(new String[]{JavaKeywords.NATIVE}), + new ArrayOfModifiers(new String[]{JavaKeywords.SYNCHRONIZED}), + new ArrayOfModifiers(new String[]{JavaKeywords.STRICTFP}, el -> !PsiUtil.isAvailable(JavaFeature.ALWAYS_STRICTFP, el)), + new ArrayOfModifiers(new String[]{JavaKeywords.VOLATILE}), + new ArrayOfModifiers(new String[]{JavaKeywords.TRANSIENT}) }; private static final ArrayOfModifiers[] FILE_MEMBER_MODIFIERS = { - new ArrayOfModifiers(new String[]{PsiKeywords.PUBLIC}), - new ArrayOfModifiers(new String[]{PsiKeywords.FINAL, PsiKeywords.ABSTRACT}), - new ArrayOfModifiers(new String[]{PsiKeywords.STRICTFP}, el -> !PsiUtil.isAvailable(JavaFeature.ALWAYS_STRICTFP, el)), - new ArrayOfModifiers(new String[]{PsiKeywords.SEALED, PsiKeywords.NON_SEALED}, JavaFeature.SEALED_CLASSES) + new ArrayOfModifiers(new String[]{JavaKeywords.PUBLIC}), + new ArrayOfModifiers(new String[]{JavaKeywords.FINAL, JavaKeywords.ABSTRACT}), + new ArrayOfModifiers(new String[]{JavaKeywords.STRICTFP}, el -> !PsiUtil.isAvailable(JavaFeature.ALWAYS_STRICTFP, el)), + new ArrayOfModifiers(new String[]{JavaKeywords.SEALED, JavaKeywords.NON_SEALED}, JavaFeature.SEALED_CLASSES) }; private static final ArrayOfModifiers[] INTERFACE_MEMBER_MODIFIERS = { - new ArrayOfModifiers(new String[]{PsiKeywords.PUBLIC, PsiKeywords.PROTECTED}, + new ArrayOfModifiers(new String[]{JavaKeywords.PUBLIC, JavaKeywords.PROTECTED}, el -> !PsiUtil.isAvailable(JavaFeature.PRIVATE_INTERFACE_METHODS, el)), - new ArrayOfModifiers(new String[]{PsiKeywords.PUBLIC, PsiKeywords.PROTECTED, PsiKeywords.PRIVATE}, JavaFeature.PRIVATE_INTERFACE_METHODS), - new ArrayOfModifiers(new String[]{PsiKeywords.FINAL, PsiKeywords.ABSTRACT}), - new ArrayOfModifiers(new String[]{PsiKeywords.STATIC, PsiKeywords.DEFAULT}, JavaFeature.STATIC_INTERFACE_CALLS), - new ArrayOfModifiers(new String[]{PsiKeywords.SEALED, PsiKeywords.NON_SEALED}, JavaFeature.SEALED_CLASSES) + new ArrayOfModifiers(new String[]{JavaKeywords.PUBLIC, JavaKeywords.PROTECTED, JavaKeywords.PRIVATE}, JavaFeature.PRIVATE_INTERFACE_METHODS), + new ArrayOfModifiers(new String[]{JavaKeywords.FINAL, JavaKeywords.ABSTRACT}), + new ArrayOfModifiers(new String[]{JavaKeywords.STATIC, JavaKeywords.DEFAULT}, JavaFeature.STATIC_INTERFACE_CALLS), + new ArrayOfModifiers(new String[]{JavaKeywords.SEALED, JavaKeywords.NON_SEALED}, JavaFeature.SEALED_CLASSES) }; static String[] getKeywords(@NotNull PsiElement position) { diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java b/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java index 424d5e32bfc9..4a34274e926d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/PreferByKindWeigher.java @@ -7,7 +7,7 @@ import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementWeigher; import com.intellij.codeInsight.lookup.TypedLookupItem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.Key; import com.intellij.patterns.ElementPattern; import com.intellij.psi.*; @@ -48,7 +48,7 @@ public class PreferByKindWeigher extends LookupElementWeigher { withParent(PsiTypeElement.class).withSuperParent(2, PsiParameter.class).withSuperParent(3, PsiCatchSection.class))); static final ElementPattern INSIDE_METHOD_THROWS_CLAUSE = - psiElement().afterLeaf(PsiKeywords.THROWS, ",").inside(psiElement(JavaElementType.THROWS_LIST)); + psiElement().afterLeaf(JavaKeywords.THROWS, ",").inside(psiElement(JavaElementType.THROWS_LIST)); static final ElementPattern IN_RESOURCE = psiElement().withParent(or( @@ -325,22 +325,22 @@ public class PreferByKindWeigher extends LookupElementWeigher { private @NotNull ThreeState isProbableKeyword(String keyword) { PsiStatement parentStatement = PsiTreeUtil.getParentOfType(myPosition, PsiStatement.class); - if (PsiKeywords.RETURN.equals(keyword)) { + if (JavaKeywords.RETURN.equals(keyword)) { if (isLastStatement(parentStatement) && !isOnTopLevelInVoidMethod(parentStatement) && !(parentStatement.getParent() instanceof PsiLoopStatement)) { return ThreeState.YES; } } - if ((PsiKeywords.BREAK.equals(keyword) || PsiKeywords.CONTINUE.equals(keyword)) && + if ((JavaKeywords.BREAK.equals(keyword) || JavaKeywords.CONTINUE.equals(keyword)) && PsiTreeUtil.getParentOfType(myPosition, PsiLoopStatement.class) != null && isLastStatement(parentStatement)) { return ThreeState.YES; } - if (PsiKeywords.ELSE.equals(keyword) || PsiKeywords.FINALLY.equals(keyword) || PsiKeywords.CATCH.equals(keyword)) { + if (JavaKeywords.ELSE.equals(keyword) || JavaKeywords.FINALLY.equals(keyword) || JavaKeywords.CATCH.equals(keyword)) { return ThreeState.YES; } - if (PsiKeywords.TRUE.equals(keyword) || PsiKeywords.FALSE.equals(keyword)) { + if (JavaKeywords.TRUE.equals(keyword) || JavaKeywords.FALSE.equals(keyword)) { if (myCompletionType == CompletionType.SMART) { boolean inReturn = psiElement().withParents(PsiReferenceExpression.class, PsiReturnStatement.class).accepts(myPosition); return inReturn ? ThreeState.YES : ThreeState.UNSURE; @@ -349,18 +349,18 @@ public class PreferByKindWeigher extends LookupElementWeigher { return ThreeState.YES; } } - if (PsiKeywords.INTERFACE.equals(keyword) && psiElement().afterLeaf("@").accepts(myPosition)) { + if (JavaKeywords.INTERFACE.equals(keyword) && psiElement().afterLeaf("@").accepts(myPosition)) { return ThreeState.NO; } - if (PsiKeywords.NULL.equals(keyword) && isComparisonRhs(myPosition)) { + if (JavaKeywords.NULL.equals(keyword) && isComparisonRhs(myPosition)) { boolean expectsNotNull = ContainerUtil.exists(myExpectedTypes, PreferByKindWeigher::isEnumClass); return expectsNotNull ? ThreeState.NO : ThreeState.YES; } - if (JavaKeywordCompletion.PRIMITIVE_TYPES.contains(keyword) || PsiKeywords.VOID.equals(keyword)) { + if (JavaKeywordCompletion.PRIMITIVE_TYPES.contains(keyword) || JavaKeywords.VOID.equals(keyword)) { boolean inCallArg = psiElement().withParents(PsiReferenceExpression.class, PsiExpressionList.class).accepts(myPosition); return inCallArg || isInMethodTypeArg(myPosition) ? ThreeState.NO : ThreeState.UNSURE; } - if (PsiKeywords.FINAL.equals(keyword) && isBeforeVariableOnSameLine(parentStatement)) { + if (JavaKeywords.FINAL.equals(keyword) && isBeforeVariableOnSameLine(parentStatement)) { return ThreeState.YES; } return ThreeState.UNSURE; diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/RecursionWeigher.java b/java/java-impl/src/com/intellij/codeInsight/completion/RecursionWeigher.java index e4b07ccc681d..9332fbcbfb9f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/RecursionWeigher.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/RecursionWeigher.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.JavaPsiEquivalenceUtil; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementWeigher; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.patterns.PsiJavaPatterns; import com.intellij.patterns.StandardPatterns; import com.intellij.psi.*; @@ -76,7 +76,7 @@ class RecursionWeigher extends LookupElementWeigher { } static @Nullable ElementFilter recursionFilter(PsiElement element) { - if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeywords.RETURN).inside(PsiReturnStatement.class).accepts(element)) { + if (PsiJavaPatterns.psiElement().afterLeaf(JavaKeywords.RETURN).inside(PsiReturnStatement.class).accepts(element)) { return new ExcludeDeclaredFilter(ElementClassFilter.METHOD); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java index b2bda873e71b..ae267a46852e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/ReferenceExpressionCompletionContributor.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.ExpectedTypeInfo; import com.intellij.codeInsight.lookup.AutoCompletionPolicy; import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.patterns.StandardPatterns; import com.intellij.psi.*; @@ -34,7 +34,7 @@ public final class ReferenceExpressionCompletionContributor { if (psiElement().inside(StandardPatterns.or(psiElement(PsiAnnotationParameterList.class), JavaCompletionContributor.IN_SWITCH_LABEL)).accepts(element)) { return new ElementExtractorFilter(new AndFilter( new ClassFilter(PsiField.class), - new ModifierFilter(PsiKeywords.STATIC, PsiKeywords.FINAL) + new ModifierFilter(JavaKeywords.STATIC, JavaKeywords.FINAL) )); } diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java index e9aed06e67a4..437e66706c41 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/scope/JavaCompletionProcessor.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.completion.scope; import com.intellij.codeInspection.SuppressManager; import com.intellij.codeInspection.accessStaticViaInstance.AccessStaticViaInstanceBase; import com.intellij.java.codeserver.highlighting.JavaErrorCollector; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Key; @@ -293,7 +293,7 @@ public final class JavaCompletionProcessor implements PsiScopeProcessor, Element if (element instanceof PsiMethod && ((PsiMethod)element).isConstructor() && myElement.getParent() instanceof PsiMethodReferenceExpression) { - name = PsiKeywords.NEW; + name = JavaKeywords.NEW; } return StringUtil.isNotEmpty(name) && myMatcher.value(name) && diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaFutureKeywordUseFixProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaFutureKeywordUseFixProvider.java index e902fd08b327..3f091c8efbf0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaFutureKeywordUseFixProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/JavaFutureKeywordUseFixProvider.java @@ -7,7 +7,7 @@ import com.intellij.codeInsight.intention.QuickFixFactory; import com.intellij.codeInsight.intention.impl.PriorityIntentionActionWrapper; import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.*; import com.intellij.psi.util.PsiTypesUtil; @@ -21,12 +21,12 @@ public final class JavaFutureKeywordUseFixProvider extends UnresolvedReferenceQu PsiTypeElement typeElement = ObjectUtils.tryCast(ref.getParent(), PsiTypeElement.class); if (typeElement == null || typeElement.getFirstChild() != typeElement.getLastChild()) return; PsiElement parent = typeElement.getParent(); - if (PsiKeywords.VAR.equals(ref.getReferenceName())) { + if (JavaKeywords.VAR.equals(ref.getReferenceName())) { registerSetVariableTypeFix(parent, registrar); registerLambdaParametersFix(parent, registrar); registerVarLanguageLevelFix(ref, parent, registrar); } - if (PsiKeywords.RECORD.equals(ref.getReferenceName())) { + if (JavaKeywords.RECORD.equals(ref.getReferenceName())) { registerRecordLanguageLevelFix(ref, parent, registrar); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/SealedClassUnresolvedReferenceFixProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/SealedClassUnresolvedReferenceFixProvider.java index 18f02f03bfde..09083f3004a2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/SealedClassUnresolvedReferenceFixProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/SealedClassUnresolvedReferenceFixProvider.java @@ -5,7 +5,7 @@ import com.intellij.codeInsight.daemon.QuickFixActionRegistrar; import com.intellij.codeInsight.intention.CommonIntentionAction; import com.intellij.codeInsight.quickfix.UnresolvedReferenceQuickFixProvider; import com.intellij.codeInspection.ConvertRecordToClassFix; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.JavaFeature; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiJavaCodeReferenceElement; @@ -16,12 +16,12 @@ import org.jetbrains.annotations.NotNull; public final class SealedClassUnresolvedReferenceFixProvider extends UnresolvedReferenceQuickFixProvider { @Override public void registerFixes(@NotNull PsiJavaCodeReferenceElement ref, @NotNull QuickFixActionRegistrar registrar) { - if (!PsiUtil.isAvailable(JavaFeature.SEALED_CLASSES, ref) && ref.textMatches(PsiKeywords.SEALED)) { + if (!PsiUtil.isAvailable(JavaFeature.SEALED_CLASSES, ref) && ref.textMatches(JavaKeywords.SEALED)) { for (CommonIntentionAction intention : HighlightFixUtil.getIncreaseLanguageLevelFixes(ref, JavaFeature.SEALED_CLASSES)) { registrar.register(intention.asIntention()); } } - if (ref.textMatches(PsiKeywords.RECORD)) { + if (ref.textMatches(JavaKeywords.RECORD)) { PsiElement parent = ref.getParent(); if (parent != null) { if (parent.getParent() instanceof PsiMethod m) { diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddReturnFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddReturnFix.java index 619feb39ec88..a36c4e88d9a0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddReturnFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddReturnFix.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.daemon.QuickFixBundle; import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil; import com.intellij.codeInsight.intention.PriorityAction; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -66,7 +66,7 @@ public class AddReturnFix extends PsiUpdateModCommandAction"; } } - final String expressionText = PsiKeywords.NEW + " " + typeText + "()"; + final String expressionText = JavaKeywords.NEW + " " + typeText + "()"; PsiExpression initializer = elementFactory.createExpressionFromText(expressionText, variable); String variableName = variable.getName(); LOG.assertTrue(variableName != null); diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java index e44cd272ab7c..a7ee6e597f5a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ChangeExtendsToImplementsFix.java @@ -4,7 +4,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.daemon.QuickFixBundle; import com.intellij.codeInsight.intention.PriorityAction; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModCommand; import com.intellij.modcommand.Presentation; @@ -45,8 +45,8 @@ public class ChangeExtendsToImplementsFix extends PsiBasedModCommandAction -1) { PsiType type = GenericsUtil.getVariableTypeByExpressionType(psiParameter.getType()); String defaultValue = TypeUtils.getDefaultValue(type); - return defaultValue.equals(PsiKeywords.NULL) ? "(" + type.getCanonicalText() + ")null" : defaultValue; + return defaultValue.equals(JavaKeywords.NULL) ? "(" + type.getCanonicalText() + ")null" : defaultValue; } return psiParameter.getName(); }, ",") + ");"; diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MakeClassInterfaceFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MakeClassInterfaceFix.java index 0e7bddb29f58..17c1160f9801 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MakeClassInterfaceFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/MakeClassInterfaceFix.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.daemon.QuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -54,7 +54,7 @@ public class MakeClassInterfaceFix extends PsiUpdateModCommandAction { private static void convertPsiClass(PsiClass aClass, final boolean makeInterface) throws IncorrectOperationException { final IElementType lookFor = makeInterface? JavaTokenType.CLASS_KEYWORD : JavaTokenType.INTERFACE_KEYWORD; - final PsiKeyword replaceWith = JavaPsiFacade.getElementFactory(aClass.getProject()).createKeyword(makeInterface ? PsiKeywords.INTERFACE : PsiKeywords.CLASS); + final PsiKeyword replaceWith = JavaPsiFacade.getElementFactory(aClass.getProject()).createKeyword(makeInterface ? JavaKeywords.INTERFACE : JavaKeywords.CLASS); for (PsiElement psiElement = aClass.getFirstChild(); psiElement != null; psiElement = psiElement.getNextSibling()) { if (psiElement instanceof PsiKeyword psiKeyword && psiKeyword.getTokenType() == lookFor) { psiKeyword.replace(replaceWith); diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java index 8b6f126b57d8..9143b9f164ef 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/NegationBroadScopeFix.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.codeInsight.daemon.QuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -33,7 +33,7 @@ public class NegationBroadScopeFix extends PsiUpdateModCommandAction { - PsiElement leaf = f.findElementAt(offset - PsiKeywords.NEW.length()); + PsiElement leaf = f.findElementAt(offset - JavaKeywords.NEW.length()); return leaf instanceof PsiKeyword && - leaf.textMatches(PsiKeywords.NEW) && + leaf.textMatches(JavaKeywords.NEW) && !PsiJavaPatterns.psiElement().insideStarting(PsiJavaPatterns.psiExpressionStatement()).accepts(leaf); }); return Result.STOP; diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java index 86715414900d..885f4a6e8aa0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java @@ -3,7 +3,7 @@ package com.intellij.codeInsight.highlighting; import com.intellij.codeInsight.ExceptionUtil; import com.intellij.featureStatistics.FeatureUsageTracker; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; @@ -21,13 +21,13 @@ public final class HighlightExceptionsHandlerFactory extends HighlightUsagesHand public HighlightUsagesHandlerBase createHighlightUsagesHandler(@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiElement target) { if (target instanceof PsiKeyword) { PsiElement parent = target.getParent(); - if (PsiKeywords.TRY.equals(target.getText()) && parent instanceof PsiTryStatement) { + if (JavaKeywords.TRY.equals(target.getText()) && parent instanceof PsiTryStatement) { return createHighlightTryHandler(editor, file, target, parent); } - if (PsiKeywords.CATCH.equals(target.getText()) && parent instanceof PsiCatchSection) { + if (JavaKeywords.CATCH.equals(target.getText()) && parent instanceof PsiCatchSection) { return createHighlightCatchHandler(editor, file, target, parent); } - if (PsiKeywords.THROWS.equals(target.getText())) { + if (JavaKeywords.THROWS.equals(target.getText())) { return createThrowsHandler(editor, file, target); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java index c1177a805acb..b8528a2bd124 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.highlighting; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.DumbAware; import com.intellij.psi.PsiElement; @@ -14,10 +14,10 @@ public final class HighlightExitPointsHandlerFactory extends HighlightUsagesHand @Override public HighlightUsagesHandlerBase createHighlightUsagesHandler(@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiElement target) { if (target instanceof PsiKeyword) { - if (PsiKeywords.RETURN.equals(target.getText()) || PsiKeywords.THROW.equals(target.getText())) { + if (JavaKeywords.RETURN.equals(target.getText()) || JavaKeywords.THROW.equals(target.getText())) { return new HighlightExitPointsHandler(editor, file, target); } - if (PsiKeywords.CONTINUE.equals(target.getText()) || PsiKeywords.BREAK.equals(target.getText()) || PsiKeywords.YIELD.equals(target.getText())) { + if (JavaKeywords.CONTINUE.equals(target.getText()) || JavaKeywords.BREAK.equals(target.getText()) || JavaKeywords.YIELD.equals(target.getText())) { return new HighlightBreakOutsHandler(editor, file, target); } } diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandlerFactory.java index 3d999a01efe2..d34d87e285bd 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightImportedElementsHandlerFactory.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.highlighting; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; @@ -14,7 +14,7 @@ public final class HighlightImportedElementsHandlerFactory extends HighlightUsag @Override public @Nullable HighlightUsagesHandlerBase createHighlightUsagesHandler(@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiElement target) { - if (!(target instanceof PsiKeyword) || !PsiKeywords.IMPORT.equals(target.getText())) { + if (!(target instanceof PsiKeyword) || !JavaKeywords.IMPORT.equals(target.getText())) { return null; } final PsiElement parent = target.getParent(); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java index a650555b56b7..2b2d43a6920f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.highlighting; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.navigation.ItemPresentation; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; @@ -28,7 +28,7 @@ public class HighlightOverridingMethodsHandler extends HighlightUsagesHandlerBas @Override public @NotNull List getTargets() { - PsiReferenceList list = PsiKeywords.EXTENDS.equals(myTarget.getText()) ? myClass.getExtendsList() : myClass.getImplementsList(); + PsiReferenceList list = JavaKeywords.EXTENDS.equals(myTarget.getText()) ? myClass.getExtendsList() : myClass.getImplementsList(); if (list == null) return Collections.emptyList(); final PsiClassType[] classTypes = list.getReferencedTypes(); return ChooseClassAndDoHighlightRunnable.resolveClasses(classTypes); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java index 3adbc4724b9f..98a29b812319 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.highlighting; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.psi.*; import org.jetbrains.annotations.NotNull; @@ -10,7 +10,7 @@ import org.jetbrains.annotations.NotNull; public final class HighlightOverridingMethodsHandlerFactory extends HighlightUsagesHandlerFactoryBase { @Override public HighlightUsagesHandlerBase createHighlightUsagesHandler(@NotNull Editor editor, @NotNull PsiFile file, @NotNull PsiElement target) { - if (target instanceof PsiKeyword && (PsiKeywords.EXTENDS.equals(target.getText()) || PsiKeywords.IMPLEMENTS.equals(target.getText()))) { + if (target instanceof PsiKeyword && (JavaKeywords.EXTENDS.equals(target.getText()) || JavaKeywords.IMPLEMENTS.equals(target.getText()))) { PsiElement parent = target.getParent(); if (!(parent instanceof PsiReferenceList)) return null; PsiElement grand = parent.getParent(); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/RemoveRedundantParameterTypesFix.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/RemoveRedundantParameterTypesFix.java index 5767fa23a23b..84c5c35fa9c3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/RemoveRedundantParameterTypesFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/RemoveRedundantParameterTypesFix.java @@ -3,7 +3,7 @@ package com.intellij.codeInsight.intention.impl; import com.intellij.codeInspection.AnonymousCanBeLambdaInspection; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandAction; @@ -80,7 +80,7 @@ public class RemoveRedundantParameterTypesFix extends PsiUpdateModCommandAction< for (PsiParameter parameter : parameters) { PsiTypeElement element = parameter.getTypeElement(); if (element != null) { - new CommentTracker().replaceAndRestoreComments(element, PsiKeywords.VAR); + new CommentTracker().replaceAndRestoreComments(element, JavaKeywords.VAR); } } return; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SwapIfStatementsIntentionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SwapIfStatementsIntentionAction.java index d2587253c424..5abb9b3d4c5d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SwapIfStatementsIntentionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SwapIfStatementsIntentionAction.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.intention.impl; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -47,7 +47,7 @@ public final class SwapIfStatementsIntentionAction extends PsiUpdateModCommandAc @Override protected @Nullable Presentation getPresentation(@NotNull ActionContext context, @NotNull PsiKeyword element) { - if (!PsiKeywords.ELSE.equals(element.getText())) { + if (!JavaKeywords.ELSE.equals(element.getText())) { return null; } final PsiElement parent = element.getParent(); diff --git a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java index 289fb0abc183..444204d8b010 100644 --- a/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java +++ b/java/java-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java @@ -10,7 +10,7 @@ import com.intellij.codeInsight.documentation.DocumentationManagerUtil; import com.intellij.codeInsight.javadoc.markdown.JavaDocMarkdownFlavourDescriptor; import com.intellij.ide.highlighter.HtmlFileType; import com.intellij.java.JavaBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.javadoc.JavadocGeneratorRunProfile; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; @@ -874,9 +874,9 @@ public class JavaDocInfoGenerator { private boolean generateClassSignature(StringBuilder buffer, PsiClass aClass, SignaturePlace place) { boolean generateLink = place == SignaturePlace.Javadoc; String classKeyword = - aClass.isInterface() ? PsiKeywords.INTERFACE : - aClass.isEnum() ? PsiKeywords.ENUM : - aClass.isRecord() ? PsiKeywords.RECORD : PsiKeywords.CLASS; + aClass.isInterface() ? JavaKeywords.INTERFACE : + aClass.isEnum() ? JavaKeywords.ENUM : + aClass.isRecord() ? JavaKeywords.RECORD : JavaKeywords.CLASS; generateAnnotations(buffer, aClass, place, true, false, true); generateModifiers(buffer, aClass, false); diff --git a/java/java-impl/src/com/intellij/codeInsight/navigation/actions/GotoVarTypeHandler.java b/java/java-impl/src/com/intellij/codeInsight/navigation/actions/GotoVarTypeHandler.java index a0a975d35137..372642774b0e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/navigation/actions/GotoVarTypeHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/navigation/actions/GotoVarTypeHandler.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.navigation.actions; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiKeyword; @@ -12,7 +12,7 @@ import org.jetbrains.annotations.Nullable; public final class GotoVarTypeHandler extends GotoDeclarationHandlerBase { @Override public @Nullable PsiElement getGotoDeclarationTarget(@Nullable PsiElement elementAt, Editor editor) { - if (elementAt instanceof PsiKeyword && PsiKeywords.VAR.equals(elementAt.getText())) { + if (elementAt instanceof PsiKeyword && JavaKeywords.VAR.equals(elementAt.getText())) { PsiElement parent = elementAt.getParent(); if (parent instanceof PsiTypeElement && ((PsiTypeElement)parent).isInferredType()) { return PsiUtil.resolveClassInClassTypeOnly(((PsiTypeElement)parent).getType()); diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/CastVarPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/CastVarPostfixTemplate.java index 2345920c4045..f729a21a58da 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/CastVarPostfixTemplate.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/CastVarPostfixTemplate.java @@ -11,12 +11,15 @@ import com.intellij.codeInsight.template.Template; import com.intellij.codeInsight.template.impl.ConstantNode; import com.intellij.codeInsight.template.impl.MacroCallNode; import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.pom.java.JavaFeature; -import com.intellij.psi.*; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiExpression; +import com.intellij.psi.PsiFile; +import com.intellij.psi.PsiType; import com.intellij.psi.codeStyle.JavaCodeStyleSettings; import com.intellij.psi.util.PsiUtil; import com.intellij.refactoring.JavaRefactoringSettings; @@ -46,7 +49,7 @@ public class CastVarPostfixTemplate extends StringBasedPostfixTemplate implement boolean useVar = Boolean.TRUE.equals(JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_VAR_TYPE) && PsiUtil.isAvailable(JavaFeature.LVTI, file); - return (isFinal ? "final " : "") + (useVar ? PsiKeywords.VAR : "$" + TYPE_VAR + "$") + + return (isFinal ? "final " : "") + (useVar ? JavaKeywords.VAR : "$" + TYPE_VAR + "$") + " $" + VAR_NAME + "$ = ($" + TYPE_VAR + "$)$expr$;$END$"; } diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java index e3aea8e36aa2..368707a05a5a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForIndexedPostfixTemplate.java @@ -7,12 +7,15 @@ import com.intellij.codeInsight.template.impl.TextExpression; import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro; import com.intellij.codeInsight.template.postfix.templates.editable.JavaEditablePostfixTemplate; import com.intellij.codeInsight.template.postfix.templates.editable.JavaPostfixTemplateExpressionCondition; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.DumbService; import com.intellij.pom.java.JavaFeature; import com.intellij.pom.java.LanguageLevel; -import com.intellij.psi.*; +import com.intellij.psi.CommonClassNames; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiExpression; +import com.intellij.psi.PsiType; import com.intellij.psi.util.PsiUtil; import com.intellij.refactoring.JavaRefactoringSettings; import com.intellij.util.containers.ContainerUtil; @@ -67,12 +70,12 @@ public abstract class ForIndexedPostfixTemplate extends JavaEditablePostfixTempl PsiType type = expr.getType(); if (Boolean.TRUE.equals(JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_VAR_TYPE) && PsiUtil.isAvailable(JavaFeature.LVTI, expr)) { - return PsiKeywords.VAR; + return JavaKeywords.VAR; } if (isNumber(type)) { return type.getCanonicalText(); } - return PsiKeywords.INT; + return JavaKeywords.INT; } @Override diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java index 7abd3bb2edf2..25f5a844dd95 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/ForeachPostfixTemplate.java @@ -9,7 +9,7 @@ import com.intellij.codeInsight.template.macro.IterableComponentTypeMacro; import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro; import com.intellij.codeInsight.template.postfix.templates.editable.JavaEditablePostfixTemplate; import com.intellij.codeInsight.template.postfix.templates.editable.JavaPostfixTemplateExpressionCondition; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbAware; import com.intellij.pom.java.JavaFeature; import com.intellij.pom.java.LanguageLevel; @@ -44,7 +44,7 @@ public class ForeachPostfixTemplate extends JavaEditablePostfixTemplate implemen if (Boolean.TRUE.equals(JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_VAR_TYPE) && element instanceof PsiExpression expr && PsiUtil.isAvailable(JavaFeature.LVTI, expr)) { - template.addVariable("TYPE", new TextExpression(PsiKeywords.VAR), false); + template.addVariable("TYPE", new TextExpression(JavaKeywords.VAR), false); } else { template.addVariable("TYPE", type, type, false); diff --git a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java index 736b4d6c5f6c..ef4c5899b4a1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java +++ b/java/java-impl/src/com/intellij/codeInsight/template/postfix/templates/TryWithResourcesPostfixTemplate.java @@ -9,7 +9,7 @@ import com.intellij.codeInsight.template.impl.MacroCallNode; import com.intellij.codeInsight.template.impl.TextExpression; import com.intellij.codeInsight.template.macro.SuggestVariableNameMacro; import com.intellij.codeInsight.template.postfix.util.JavaPostfixTemplatesUtils; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.DumbAware; @@ -67,7 +67,7 @@ public class TryWithResourcesPostfixTemplate extends PostfixTemplate implements DumbService dumbService = DumbService.getInstance(project); if (Boolean.TRUE.equals(JavaRefactoringSettings.getInstance().INTRODUCE_LOCAL_CREATE_VAR_TYPE) && PsiUtil.isAvailable(JavaFeature.LVTI, expression)) { - template.addVariable("type", new TextExpression(PsiKeywords.VAR), false); + template.addVariable("type", new TextExpression(JavaKeywords.VAR), false); } else { PsiType type = dumbService.computeWithAlternativeResolveEnabled(expression::getType); template.addVariable("type", new TypeExpression(project, new PsiType[]{type}), false); diff --git a/java/java-impl/src/com/intellij/codeInspection/ConvertRecordToClassFix.java b/java/java-impl/src/com/intellij/codeInspection/ConvertRecordToClassFix.java index 3effacb44f1b..e87a32a38d9f 100644 --- a/java/java-impl/src/com/intellij/codeInspection/ConvertRecordToClassFix.java +++ b/java/java-impl/src/com/intellij/codeInspection/ConvertRecordToClassFix.java @@ -8,8 +8,8 @@ import com.intellij.codeInsight.intention.impl.ConvertCompactConstructorToCanoni import com.intellij.codeInspection.util.IntentionFamilyName; import com.intellij.java.JavaBundle; import com.intellij.java.syntax.parser.DeclarationParser; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.java.syntax.parser.JavaParser; -import com.intellij.java.syntax.parser.PsiKeywords; import com.intellij.lang.java.JavaLanguage; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; @@ -325,7 +325,7 @@ public class ConvertRecordToClassFix extends PsiUpdateModCommandAction ALL_BOOLEAN_BRANCHES = List.of(PsiKeywords.TRUE, PsiKeywords.FALSE); + private static final List ALL_BOOLEAN_BRANCHES = List.of(JavaKeywords.TRUE, JavaKeywords.FALSE); private CreateMissingBooleanPrimitiveBranchesFix(@NotNull PsiSwitchBlock block, @NotNull Set names) { super(block, names); diff --git a/java/java-impl/src/com/siyeh/ig/jdk/ForwardCompatibilityInspection.java b/java/java-impl/src/com/siyeh/ig/jdk/ForwardCompatibilityInspection.java index 4b1a21dc065f..5b697dd162c3 100644 --- a/java/java-impl/src/com/siyeh/ig/jdk/ForwardCompatibilityInspection.java +++ b/java/java-impl/src/com/siyeh/ig/jdk/ForwardCompatibilityInspection.java @@ -7,7 +7,7 @@ import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool; import com.intellij.codeInspection.LocalQuickFix; import com.intellij.codeInspection.ProblemsHolder; import com.intellij.codeInspection.util.InspectionMessage; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -42,19 +42,19 @@ public final class ForwardCompatibilityInspection extends AbstractBaseJavaLocalI PsiElement parent = identifier.getParent(); JavaFeature feature = PsiUtil.softKeywordFeature(name); if (feature != null && - feature != JavaFeature.MODULES && !name.equals(PsiKeywords.WHEN) &&// Keywords from module-info and 'when' still can be used as class names + feature != JavaFeature.MODULES && !name.equals(JavaKeywords.WHEN) &&// Keywords from module-info and 'when' still can be used as class names !feature.isSufficient(languageLevel) && parent instanceof PsiClass) { return JavaErrorBundle.message("restricted.identifier.warn", name, feature.getMinimumLevel().feature()); } switch (name) { - case PsiKeywords.ASSERT -> { + case JavaKeywords.ASSERT -> { if (!JavaFeature.ASSERTIONS.isSufficient(languageLevel) && (parent instanceof PsiClass || parent instanceof PsiMethod || parent instanceof PsiVariable)) { return JavaErrorBundle.message("assert.identifier.warn"); } } - case PsiKeywords.ENUM -> { + case JavaKeywords.ENUM -> { if (!JavaFeature.ENUMS.isSufficient(languageLevel) && (parent instanceof PsiClass || parent instanceof PsiMethod || parent instanceof PsiVariable)) { return JavaErrorBundle.message("enum.identifier.warn"); @@ -73,7 +73,7 @@ public final class ForwardCompatibilityInspection extends AbstractBaseJavaLocalI public void visitMethodCallExpression(@NotNull PsiMethodCallExpression expression) { PsiReferenceExpression ref = expression.getMethodExpression(); PsiElement nameElement = ref.getReferenceNameElement(); - if (nameElement != null && PsiKeywords.YIELD.equals(nameElement.getText()) && ref.getQualifierExpression() == null && + if (nameElement != null && JavaKeywords.YIELD.equals(nameElement.getText()) && ref.getQualifierExpression() == null && !JavaFeature.SWITCH_EXPRESSION.isSufficient(languageLevel)) { PsiExpression qualifier = ExpressionUtils.getEffectiveQualifier(expression.getMethodExpression()); String message = JavaErrorBundle.message("yield.unqualified.method.warn"); @@ -90,7 +90,7 @@ public final class ForwardCompatibilityInspection extends AbstractBaseJavaLocalI super.visitKeyword(keyword); if (languageLevel.isAtLeast(LanguageLevel.JDK_1_9) && !languageLevel.isAtLeast(LanguageLevel.JDK_10)) { @PsiModifier.ModifierConstant String modifier = keyword.getText(); - if (PsiKeywords.STATIC.equals(modifier) || PsiKeywords.TRANSITIVE.equals(modifier)) { + if (JavaKeywords.STATIC.equals(modifier) || JavaKeywords.TRANSITIVE.equals(modifier)) { PsiElement parent = keyword.getParent(); if (parent instanceof PsiModifierList) { PsiElement grand = parent.getParent(); diff --git a/java/java-impl/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java b/java/java-impl/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java index 8650368f163d..914c4a5891d4 100644 --- a/java/java-impl/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java +++ b/java/java-impl/src/com/siyeh/ig/migration/IfCanBeSwitchInspection.java @@ -9,7 +9,7 @@ import com.intellij.codeInspection.ProblemHighlightType; import com.intellij.codeInspection.dataFlow.NullabilityUtil; import com.intellij.codeInspection.options.OptPane; import com.intellij.codeInspection.util.IntentionFamilyName; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -86,7 +86,7 @@ public final class IfCanBeSwitchInspection extends BaseInspection { } public static @IntentionFamilyName @NotNull String getReplaceWithSwitchFixName(){ - return CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.IF, PsiKeywords.SWITCH); + return CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.IF, JavaKeywords.SWITCH); } private static class IfCanBeSwitchFix extends PsiUpdateModCommandQuickFix { diff --git a/java/java-impl/src/com/siyeh/ig/redundancy/OnlyOneElementUsedInspection.java b/java/java-impl/src/com/siyeh/ig/redundancy/OnlyOneElementUsedInspection.java index 3de09dac5a17..fd85f4b370a3 100644 --- a/java/java-impl/src/com/siyeh/ig/redundancy/OnlyOneElementUsedInspection.java +++ b/java/java-impl/src/com/siyeh/ig/redundancy/OnlyOneElementUsedInspection.java @@ -5,7 +5,7 @@ import com.intellij.codeInspection.AbstractBaseJavaLocalInspectionTool; import com.intellij.codeInspection.CleanupLocalInspectionTool; import com.intellij.codeInspection.CommonQuickFixBundle; import com.intellij.codeInspection.ProblemsHolder; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -29,13 +29,13 @@ public final class OnlyOneElementUsedInspection extends AbstractBaseJavaLocalIns private static class RedundantElementAccessVisitor extends JavaElementVisitor { private static final CallMatcher LIST_GET = CallMatcher.instanceCall(CommonClassNames.JAVA_UTIL_LIST, "get") - .parameterTypes(PsiKeywords.INT); + .parameterTypes(JavaKeywords.INT); private static final CallMatcher LIST_CONSTRUCTOR = CallMatcher.anyOf( CallMatcher.staticCall(CommonClassNames.JAVA_UTIL_LIST, "of"), CallMatcher.staticCall(CommonClassNames.JAVA_UTIL_ARRAYS, "asList") ); private static final CallMatcher STRING_CHAR_AT = CallMatcher.instanceCall(CommonClassNames.JAVA_LANG_STRING, "charAt") - .parameterTypes(PsiKeywords.INT); + .parameterTypes(JavaKeywords.INT); private final @NotNull ProblemsHolder myHolder; private RedundantElementAccessVisitor(@NotNull ProblemsHolder holder) { myHolder = holder; } diff --git a/java/java-impl/src/com/siyeh/ig/redundancy/RedundantClassCallInspection.java b/java/java-impl/src/com/siyeh/ig/redundancy/RedundantClassCallInspection.java index cf98ef57fbe2..40c3e5fc97f2 100644 --- a/java/java-impl/src/com/siyeh/ig/redundancy/RedundantClassCallInspection.java +++ b/java/java-impl/src/com/siyeh/ig/redundancy/RedundantClassCallInspection.java @@ -2,7 +2,7 @@ package com.siyeh.ig.redundancy; import com.intellij.codeInspection.*; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.PsiUpdateModCommandQuickFix; import com.intellij.openapi.project.Project; @@ -91,7 +91,7 @@ public final class RedundantClassCallInspection extends AbstractBaseJavaLocalIns @Override public @NotNull String getFamilyName() { - return CommonQuickFixBundle.message("fix.replace.with.x", PsiKeywords.INSTANCEOF); + return CommonQuickFixBundle.message("fix.replace.with.x", JavaKeywords.INSTANCEOF); } @Override diff --git a/java/java-impl/src/com/siyeh/ig/style/BoundedWildcardInspection.java b/java/java-impl/src/com/siyeh/ig/style/BoundedWildcardInspection.java index 40dbcd82f4ae..89b3895b67e7 100644 --- a/java/java-impl/src/com/siyeh/ig/style/BoundedWildcardInspection.java +++ b/java/java-impl/src/com/siyeh/ig/style/BoundedWildcardInspection.java @@ -6,7 +6,7 @@ import com.intellij.codeInspection.options.OptPane; import com.intellij.ide.util.SuperMethodWarningUtil; import com.intellij.java.JavaBundle; import com.intellij.java.codeserver.highlighting.JavaErrorCollector; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.command.WriteCommandAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProgressManager; @@ -103,7 +103,7 @@ public final class BoundedWildcardInspection extends AbstractBaseJavaLocalInspec @Override public @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull String getFamilyName() { - return CommonQuickFixBundle.message("fix.replace.with.x", "? " + (isExtends ? PsiKeywords.EXTENDS : PsiKeywords.SUPER)); + return CommonQuickFixBundle.message("fix.replace.with.x", "? " + (isExtends ? JavaKeywords.EXTENDS : JavaKeywords.SUPER)); } @Override diff --git a/java/java-impl/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java b/java/java-impl/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java index a7a681a8cf2f..3c56c76bd7ff 100644 --- a/java/java-impl/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java +++ b/java/java-impl/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java @@ -17,7 +17,7 @@ package com.siyeh.ipp.forloop; import com.intellij.codeInsight.BlockUtils; import com.intellij.codeInspection.util.IntentionName; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; @@ -82,7 +82,7 @@ public class ReplaceForEachLoopWithIndexedForLoopIntention extends MCIntention { newStatement.append("final "); } PsiTypeElement typeElement = iterationParameter.getTypeElement(); - newStatement.append(typeElement != null && typeElement.isInferredType() ? PsiKeywords.VAR : type.getCanonicalText()); + newStatement.append(typeElement != null && typeElement.isInferredType() ? JavaKeywords.VAR : type.getCanonicalText()); newStatement.append(' '); newStatement.append(iterationParameter.getName()); newStatement.append('='); diff --git a/java/java-impl/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java b/java/java-impl/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java index 28bae04b3eeb..70db2a5a0b55 100644 --- a/java/java-impl/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java +++ b/java/java-impl/src/com/siyeh/ipp/junit/DataPointHolderConversionIntention.java @@ -2,7 +2,7 @@ package com.siyeh.ipp.junit; import com.intellij.codeInsight.AnnotationUtil; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.modcommand.ActionContext; import com.intellij.modcommand.ModPsiUpdater; import com.intellij.modcommand.Presentation; @@ -83,7 +83,7 @@ public final class DataPointHolderConversionIntention extends PsiUpdateModComman assert body != null; final PsiStatement methodCode = - elementFactory.createStatementFromText(PsiKeywords.RETURN + " " + requireNonNull(fieldInitializer).getText() + ";", null); + elementFactory.createStatementFromText(JavaKeywords.RETURN + " " + requireNonNull(fieldInitializer).getText() + ";", null); body.add(methodCode); return method; } diff --git a/java/java-impl/src/com/siyeh/ipp/trivialif/MergeElseIfPredicate.java b/java/java-impl/src/com/siyeh/ipp/trivialif/MergeElseIfPredicate.java index eb43bc82d813..93b5cc9c56f2 100644 --- a/java/java-impl/src/com/siyeh/ipp/trivialif/MergeElseIfPredicate.java +++ b/java/java-impl/src/com/siyeh/ipp/trivialif/MergeElseIfPredicate.java @@ -15,7 +15,7 @@ */ package com.siyeh.ipp.trivialif; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.siyeh.ipp.base.PsiElementPredicate; import com.siyeh.ipp.psiutils.ErrorUtil; @@ -29,7 +29,7 @@ class MergeElseIfPredicate implements PsiElementPredicate { return false; } final @NonNls String text = element.getText(); - if (!PsiKeywords.ELSE.equals(text)) { + if (!JavaKeywords.ELSE.equals(text)) { return false; } final PsiElement parent = token.getParent(); diff --git a/java/java-impl/src/com/siyeh/ipp/trivialif/SplitElseIfPredicate.java b/java/java-impl/src/com/siyeh/ipp/trivialif/SplitElseIfPredicate.java index 5103df46489a..613c46d7a315 100644 --- a/java/java-impl/src/com/siyeh/ipp/trivialif/SplitElseIfPredicate.java +++ b/java/java-impl/src/com/siyeh/ipp/trivialif/SplitElseIfPredicate.java @@ -15,8 +15,11 @@ */ package com.siyeh.ipp.trivialif; -import com.intellij.java.syntax.parser.PsiKeywords; -import com.intellij.psi.*; +import com.intellij.java.syntax.parser.JavaKeywords; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiIfStatement; +import com.intellij.psi.PsiJavaToken; +import com.intellij.psi.PsiStatement; import com.siyeh.ipp.base.PsiElementPredicate; import com.siyeh.ipp.psiutils.ErrorUtil; import org.jetbrains.annotations.NonNls; @@ -29,7 +32,7 @@ class SplitElseIfPredicate implements PsiElementPredicate { return false; } final @NonNls String text = element.getText(); - if (!PsiKeywords.ELSE.equals(text)) { + if (!JavaKeywords.ELSE.equals(text)) { return false; } final PsiElement parent = token.getParent(); diff --git a/java/java-indexing-impl/src/com/intellij/psi/impl/search/ConstructorReferencesSearchHelper.java b/java/java-indexing-impl/src/com/intellij/psi/impl/search/ConstructorReferencesSearchHelper.java index 49100ced5fb5..379c9eade601 100644 --- a/java/java-indexing-impl/src/com/intellij/psi/impl/search/ConstructorReferencesSearchHelper.java +++ b/java/java-indexing-impl/src/com/intellij/psi/impl/search/ConstructorReferencesSearchHelper.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.search; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.TextRange; @@ -98,7 +98,7 @@ class ConstructorReferencesSearchHelper { if (!DumbService.getInstance(project).runReadActionInSmartMode( () -> processSuperOrThis(containingClass, constructor, constructorCanBeCalledImplicitly[0], searchScope, project, isStrictSignatureSearch, - PsiKeywords.THIS, PsiKeywords.SUPER, processor))) { + JavaKeywords.THIS, JavaKeywords.SUPER, processor))) { return false; } @@ -107,7 +107,7 @@ class ConstructorReferencesSearchHelper { final PsiElement navigationElement = inheritor.getNavigationElement(); if (navigationElement instanceof PsiClass) { return processSuperOrThis((PsiClass)navigationElement, constructor, constructorCanBeCalledImplicitly[0], searchScope, project, - isStrictSignatureSearch, PsiKeywords.SUPER, PsiKeywords.THIS, processor); + isStrictSignatureSearch, JavaKeywords.SUPER, JavaKeywords.THIS, processor); } return true; }; diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiExpressionTrimRenderer.java b/java/java-psi-api/src/com/intellij/psi/util/PsiExpressionTrimRenderer.java index 48b8a79c0268..203948794234 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiExpressionTrimRenderer.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiExpressionTrimRenderer.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.util; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.NlsSafe; import com.intellij.psi.*; import com.intellij.util.NotNullFunction; @@ -22,7 +22,7 @@ public class PsiExpressionTrimRenderer extends JavaRecursiveElementWalkingVisito @Override public void visitInstanceOfExpression(@NotNull PsiInstanceOfExpression expression) { expression.getOperand().accept(this); - myBuf.append(" ").append(PsiKeywords.INSTANCEOF).append(" "); + myBuf.append(" ").append(JavaKeywords.INSTANCEOF).append(" "); final PsiTypeElement checkType = expression.getCheckType(); if (checkType != null) { myBuf.append(checkType.getText()); @@ -212,14 +212,14 @@ public class PsiExpressionTrimRenderer extends JavaRecursiveElementWalkingVisito final PsiExpressionList argumentList = expr.getArgumentList(); if (anonymousClass != null) { - myBuf.append(PsiKeywords.NEW).append(" ").append(anonymousClass.getBaseClassType().getPresentableText()); + myBuf.append(JavaKeywords.NEW).append(" ").append(anonymousClass.getBaseClassType().getPresentableText()); if (argumentList != null) argumentList.accept(this); myBuf.append(" {...}"); } else { final PsiJavaCodeReferenceElement reference = expr.getClassReference(); if (reference != null) { - myBuf.append(PsiKeywords.NEW).append(" ").append(reference.getText()); + myBuf.append(JavaKeywords.NEW).append(" ").append(reference.getText()); final PsiExpression[] arrayDimensions = expr.getArrayDimensions(); final PsiType type = expr.getType(); diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java index 16e6ca103e73..3d0688eb2ae4 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiTypesUtil.java @@ -2,7 +2,7 @@ package com.intellij.psi.util; import com.intellij.codeInsight.ExternalAnnotationsManager; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Attachment; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -93,7 +93,7 @@ public final class PsiTypesUtil { */ public static @NotNull String getDefaultValueOfType(@Nullable PsiType type, boolean customDefaultValues) { if (type instanceof PsiPrimitiveType) { - return PsiTypes.booleanType().equals(type) ? PsiKeywords.FALSE : "0"; + return PsiTypes.booleanType().equals(type) ? JavaKeywords.FALSE : "0"; } if (customDefaultValues) { if (type instanceof PsiArrayType) { @@ -103,13 +103,13 @@ public final class PsiTypesUtil { if (componentType instanceof PsiClassType) { final PsiClassType classType = (PsiClassType)componentType; if (classType.resolve() instanceof PsiTypeParameter) { - return PsiKeywords.NULL; + return JavaKeywords.NULL; } } PsiType erasedComponentType = TypeConversionUtil.erasure(componentType); StringBuilder buffer = new StringBuilder(); - buffer.append(PsiKeywords.NEW); + buffer.append(JavaKeywords.NEW); buffer.append(" "); buffer.append(erasedComponentType.getCanonicalText()); buffer.append("[0]"); @@ -156,7 +156,7 @@ public final class PsiTypesUtil { } } } - return PsiKeywords.NULL; + return JavaKeywords.NULL; } /** @@ -793,11 +793,11 @@ public final class PsiTypesUtil { * (e.g. 'when') */ public static boolean isRestrictedIdentifier(@Nullable String typeName, @NotNull LanguageLevel level) { - return PsiKeywords.VAR.equals(typeName) && JavaFeature.LVTI.isSufficient(level) || - PsiKeywords.YIELD.equals(typeName) && JavaFeature.SWITCH_EXPRESSION.isSufficient(level) || - PsiKeywords.RECORD.equals(typeName) && JavaFeature.RECORDS.isSufficient(level) || - (PsiKeywords.SEALED.equals(typeName) || PsiKeywords.PERMITS.equals(typeName)) && JavaFeature.SEALED_CLASSES.isSufficient(level) || - PsiKeywords.VALUE.equals(typeName) && JavaFeature.VALHALLA_VALUE_CLASSES.isSufficient(level); + return JavaKeywords.VAR.equals(typeName) && JavaFeature.LVTI.isSufficient(level) || + JavaKeywords.YIELD.equals(typeName) && JavaFeature.SWITCH_EXPRESSION.isSufficient(level) || + JavaKeywords.RECORD.equals(typeName) && JavaFeature.RECORDS.isSufficient(level) || + (JavaKeywords.SEALED.equals(typeName) || JavaKeywords.PERMITS.equals(typeName)) && JavaFeature.SEALED_CLASSES.isSufficient(level) || + JavaKeywords.VALUE.equals(typeName) && JavaFeature.VALHALLA_VALUE_CLASSES.isSufficient(level); } public static class TypeParameterSearcher extends PsiTypeVisitor { diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java index 68610aafd03b..ea9f66443289 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java @@ -44,7 +44,7 @@ import java.util.*; import java.util.function.Predicate; import java.util.regex.Pattern; -import static com.intellij.java.syntax.parser.PsiKeywords.*; +import static com.intellij.java.syntax.parser.JavaKeywords.*; public final class PsiUtil extends PsiUtilCore { private static final Logger LOG = Logger.getInstance(PsiUtil.class); diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java index 011ef331ebac..2bdf0ac6624a 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/completion/scope/CompletionElement.java @@ -2,7 +2,7 @@ package com.intellij.codeInsight.completion.scope; import com.intellij.codeInsight.completion.CompletionUtilCoreImpl; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Trinity; import com.intellij.psi.*; @@ -55,7 +55,7 @@ public final class CompletionElement{ } if(myElement instanceof PsiMethod){ if (myMethodRefType != null) { - return ((PsiMethod)myElement).isConstructor() ? PsiKeywords.NEW : ((PsiMethod)myElement).getName(); + return ((PsiMethod)myElement).isConstructor() ? JavaKeywords.NEW : ((PsiMethod)myElement).getName(); } return Trinity.create(((PsiMethod)myElement).getName(), diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/RecordAugmentProvider.java b/java/java-psi-impl/src/com/intellij/psi/impl/RecordAugmentProvider.java index c09e73bad984..02ac7102d50f 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/RecordAugmentProvider.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/RecordAugmentProvider.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.util.text.StringUtil; import com.intellij.psi.*; @@ -140,7 +140,7 @@ public final class RecordAugmentProvider extends PsiAugmentProvider implements D private static boolean hasForbiddenType(@NotNull PsiRecordComponent component) { PsiTypeElement typeElement = component.getTypeElement(); - return typeElement == null || typeElement.getText().equals(PsiKeywords.RECORD); + return typeElement == null || typeElement.getText().equals(JavaKeywords.RECORD); } private static @Nullable String getTypeText(@NotNull PsiRecordComponent component) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassObjectAccessExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassObjectAccessExpressionImpl.java index 81469bad2fee..d5fdb1e8282a 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassObjectAccessExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsClassObjectAccessExpressionImpl.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.compiled; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.impl.PsiImplUtil; import com.intellij.psi.impl.source.SourceTreeToPsiMap; @@ -25,7 +25,7 @@ public final class ClsClassObjectAccessExpressionImpl extends ClsElementImpl imp @Override public void appendMirrorText(int indentLevel, @NotNull StringBuilder buffer) { myTypeElement.appendMirrorText(0, buffer); - buffer.append('.').append(PsiKeywords.CLASS); + buffer.append('.').append(JavaKeywords.CLASS); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java index bc875474e2c3..7a03e0fdc2d9 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/compiled/ClsReferenceListImpl.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.compiled; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.util.NotNullLazyValue; import com.intellij.psi.*; import com.intellij.psi.impl.cache.TypeInfo; @@ -53,22 +53,22 @@ public final class ClsReferenceListImpl extends ClsRepositoryPsiElement> implements return stub.isValueClass(); } - return hasModifierProperty(PsiKeywords.VALUE); + return hasModifierProperty(JavaKeywords.VALUE); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java index e6ee797603d7..dd1630bbc72d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiJavaFileBaseImpl.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.source; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.lang.Language; import com.intellij.lang.java.JavaLanguage; @@ -150,7 +150,7 @@ public abstract class PsiJavaFileBaseImpl extends PsiFileImpl implements PsiJava private void cleanupBrokenPackageKeyword() { PsiElement child = getFirstChild(); while (child instanceof PsiWhiteSpace || child instanceof PsiComment || child instanceof PsiErrorElement) { - if (child instanceof PsiErrorElement && child.getFirstChild() != null && child.getFirstChild().textMatches(PsiKeywords.PACKAGE)) { + if (child instanceof PsiErrorElement && child.getFirstChild() != null && child.getFirstChild().textMatches(JavaKeywords.PACKAGE)) { child.delete(); break; } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java index 68a44f820d97..3be53ccf92ee 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiMethodReferenceExpressionImpl.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.impl.source.tree.java; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.TextRange; @@ -327,7 +327,7 @@ public final class PsiMethodReferenceExpressionImpl extends JavaStubPsiElement = hashSetOf(PsiKeywords.REQUIRES, PsiKeywords.EXPORTS, PsiKeywords.USES, PsiKeywords.PROVIDES) +private val STATEMENT_KEYWORDS: Set = hashSetOf(JavaKeywords.REQUIRES, JavaKeywords.EXPORTS, JavaKeywords.USES, JavaKeywords.PROVIDES) diff --git a/java/java-syntax/src/com/intellij/java/syntax/parser/PatternParser.kt b/java/java-syntax/src/com/intellij/java/syntax/parser/PatternParser.kt index 1305b4d4afa7..9d7df6885a69 100644 --- a/java/java-syntax/src/com/intellij/java/syntax/parser/PatternParser.kt +++ b/java/java-syntax/src/com/intellij/java/syntax/parser/PatternParser.kt @@ -126,7 +126,7 @@ class PatternParser(private val myParser: JavaParser) { val hasIdentifier: Boolean if (builder.tokenType === JavaSyntaxTokenType.IDENTIFIER && - (PsiKeywords.WHEN != builder.tokenText || isWhenAsIdentifier(isRecord)) + (JavaKeywords.WHEN != builder.tokenText || isWhenAsIdentifier(isRecord)) ) { // pattern variable after the record structure pattern if (isRecord) { diff --git a/java/java-syntax/src/com/intellij/java/syntax/parser/ReferenceParser.kt b/java/java-syntax/src/com/intellij/java/syntax/parser/ReferenceParser.kt index 5f08c7e0d001..abff485fd2df 100644 --- a/java/java-syntax/src/com/intellij/java/syntax/parser/ReferenceParser.kt +++ b/java/java-syntax/src/com/intellij/java/syntax/parser/ReferenceParser.kt @@ -72,7 +72,7 @@ class ReferenceParser(private val myParser: JavaParser) { isSet(flags, VAR_TYPE) && builder.lookAhead(1) !== JavaSyntaxTokenType.DOT && builder.lookAhead(1) !== JavaSyntaxTokenType.COLON && - PsiKeywords.VAR == builder.tokenText && + JavaKeywords.VAR == builder.tokenText && JavaFeature.LVTI.isSufficient(myParser.languageLevel) ) { builder.remapCurrentToken(JavaSyntaxTokenType.VAR_KEYWORD.also { tokenType = it }) diff --git a/java/java-syntax/src/com/intellij/java/syntax/parser/StatementParser.kt b/java/java-syntax/src/com/intellij/java/syntax/parser/StatementParser.kt index 6a6614d4583f..434c6c6ff998 100644 --- a/java/java-syntax/src/com/intellij/java/syntax/parser/StatementParser.kt +++ b/java/java-syntax/src/com/intellij/java/syntax/parser/StatementParser.kt @@ -208,12 +208,12 @@ class StatementParser(private val myParser: JavaParser) { pos.rollbackTo() if (singleToken && builder.tokenType === JavaSyntaxTokenType.IDENTIFIER) { val text = builder.tokenText - if (PsiKeywords.RECORD == text && JavaFeature.RECORDS.isSufficient( + if (JavaKeywords.RECORD == text && JavaFeature.RECORDS.isSufficient( this.languageLevel) ) { incompleteDeclarationRestrictedTokenType = JavaSyntaxTokenType.RECORD_KEYWORD } - if (PsiKeywords.VAR == text && JavaFeature.LVTI.isSufficient( + if (JavaKeywords.VAR == text && JavaFeature.LVTI.isSufficient( this.languageLevel) ) { incompleteDeclarationRestrictedTokenType = JavaSyntaxTokenType.VAR_KEYWORD @@ -265,7 +265,7 @@ class StatementParser(private val myParser: JavaParser) { private fun isStmtYieldToken(builder: SyntaxTreeBuilder, tokenType: SyntaxElementType?): Boolean { if (!(tokenType === JavaSyntaxTokenType.IDENTIFIER && - PsiKeywords.YIELD == builder.tokenText && + JavaKeywords.YIELD == builder.tokenText && JavaFeature.SWITCH_EXPRESSION.isSufficient(this.languageLevel)) ) { return false @@ -601,7 +601,7 @@ class StatementParser(private val myParser: JavaParser) { } private fun parseGuard(builder: SyntaxTreeBuilder) { - if (builder.tokenType === JavaSyntaxTokenType.IDENTIFIER && PsiKeywords.WHEN == builder.tokenText) { + if (builder.tokenType === JavaSyntaxTokenType.IDENTIFIER && JavaKeywords.WHEN == builder.tokenText) { builder.remapCurrentToken(JavaSyntaxTokenType.WHEN_KEYWORD) builder.advanceLexer() val guardingExpression = myParser.expressionParser.parseAssignmentForbiddingLambda(builder) diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt index 5d3e77c10197..eff613fe0bb6 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/problems/ClassProblemsTest.kt @@ -3,7 +3,7 @@ package com.intellij.java.codeInsight.daemon.problems import com.intellij.codeInsight.daemon.problems.Problem import com.intellij.codeInsight.daemon.problems.pass.ProjectProblemUtils -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.lang.java.JavaLanguage import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.command.undo.UndoManager @@ -126,7 +126,7 @@ internal class ClassProblemsTest : ProjectProblemsViewTest() { doTest(targetClass) { changeClass(targetClass) { psiClass, factory -> val classKeyword = PsiTreeUtil.getPrevSiblingOfType(psiClass.nameIdentifier, PsiKeyword::class.java) - val interfaceKeyword = factory.createKeyword(PsiKeywords.INTERFACE) + val interfaceKeyword = factory.createKeyword(JavaKeywords.INTERFACE) classKeyword?.replace(interfaceKeyword) } assertTrue(hasReportedProblems(refClass)) diff --git a/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java b/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java index 9ecdcc28a230..0ee6057c3b99 100644 --- a/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java +++ b/java/java-tests/testSrc/com/intellij/java/propertyBased/JavaCompletionPolicy.java @@ -3,7 +3,7 @@ package com.intellij.java.propertyBased; import com.intellij.codeInsight.completion.JavaCompletionContributor; import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.editor.Editor; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; @@ -122,7 +122,7 @@ class JavaCompletionPolicy extends CompletionPolicy { return false; } } - if (leaf.textMatches(PsiKeywords.TRUE) || leaf.textMatches(PsiKeywords.FALSE)) { + if (leaf.textMatches(JavaKeywords.TRUE) || leaf.textMatches(JavaKeywords.FALSE)) { return false; // boolean literal presence depends on expected types, which can be missing in red files } if (PsiUtil.isSoftKeyword(leaf.getText(), LanguageLevel.JDK_1_9) && diff --git a/java/java-tests/testSrc/com/intellij/java/propertyBased/ProjectProblemsViewPropertyTest.kt b/java/java-tests/testSrc/com/intellij/java/propertyBased/ProjectProblemsViewPropertyTest.kt index 6fb8a36640dd..57c6c5178a69 100644 --- a/java/java-tests/testSrc/com/intellij/java/propertyBased/ProjectProblemsViewPropertyTest.kt +++ b/java/java-tests/testSrc/com/intellij/java/propertyBased/ProjectProblemsViewPropertyTest.kt @@ -9,7 +9,7 @@ import com.intellij.codeInsight.daemon.problems.Problem import com.intellij.codeInsight.daemon.problems.pass.ProjectProblemUtils import com.intellij.codeInsight.javadoc.JavaDocUtil import com.intellij.idea.IgnoreJUnit3 -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.lang.annotation.HighlightSeverity import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.editor.Editor @@ -36,7 +36,6 @@ import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl import com.intellij.testFramework.propertyBased.MadTestingUtil import com.intellij.util.ArrayUtilRt import com.siyeh.ig.psiutils.TypeUtils -import junit.framework.TestCase import org.jetbrains.jetCheck.Generator import org.jetbrains.jetCheck.ImperativeCommand import org.jetbrains.jetCheck.PropertyChecker @@ -446,7 +445,7 @@ class ProjectProblemsViewPropertyTest : BaseUnivocityTest() { if (psiClass.isEnum || psiClass.isInterface || psiClass.isAnnotationType) return val classKeyword = PsiTreeUtil.getPrevSiblingOfType(psiClass.nameIdentifier!!, PsiKeyword::class.java) ?: return val factory = JavaPsiFacade.getElementFactory(project) - val newTypeKeyword = factory.createKeyword(PsiKeywords.INTERFACE) + val newTypeKeyword = factory.createKeyword(JavaKeywords.INTERFACE) PsiUtil.setModifierProperty(psiClass, PsiModifier.ABSTRACT, false) PsiUtil.setModifierProperty(psiClass, PsiModifier.FINAL, false) classKeyword.replace(newTypeKeyword) diff --git a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePatternSwitchFixTest.java b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePatternSwitchFixTest.java index 0f11c7177023..79ba9e1ea061 100644 --- a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePatternSwitchFixTest.java +++ b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePatternSwitchFixTest.java @@ -2,7 +2,7 @@ package com.siyeh.ig.fixes.migration; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.IdeaTestUtil; @@ -19,7 +19,7 @@ public class IfCanBePatternSwitchFixTest extends IGQuickFixesTestCase { inspection.minimumBranches = 2; myFixture.enableInspections(inspection); myRelativePath = "migration/if_can_be_switch"; - myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.IF, PsiKeywords.SWITCH); + myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.IF, JavaKeywords.SWITCH); ModuleRootModificationUtil.updateModel(getModule(), DefaultLightProjectDescriptor::addJetBrainsAnnotationsWithTypeUse); } diff --git a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePrimitivePatternSwitchFixTest.java b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePrimitivePatternSwitchFixTest.java index 30a96142cb7e..9e16921d10b2 100644 --- a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePrimitivePatternSwitchFixTest.java +++ b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBePrimitivePatternSwitchFixTest.java @@ -2,7 +2,7 @@ package com.siyeh.ig.fixes.migration; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.pom.java.JavaFeature; import com.intellij.testFramework.IdeaTestUtil; @@ -19,7 +19,7 @@ public class IfCanBePrimitivePatternSwitchFixTest extends IGQuickFixesTestCase { inspection.minimumBranches = 2; myFixture.enableInspections(inspection); myRelativePath = "migration/if_can_be_switch"; - myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.IF, PsiKeywords.SWITCH); + myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.IF, JavaKeywords.SWITCH); ModuleRootModificationUtil.updateModel(getModule(), DefaultLightProjectDescriptor::addJetBrainsAnnotationsWithTypeUse); } diff --git a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixOutdatedTest.java b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixOutdatedTest.java index 1c6e8f49f48c..b32dbce77226 100644 --- a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixOutdatedTest.java +++ b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixOutdatedTest.java @@ -2,7 +2,7 @@ package com.siyeh.ig.fixes.migration; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.IdeaTestUtil; import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; @@ -21,7 +21,7 @@ public class IfCanBeSwitchFixOutdatedTest extends IGQuickFixesTestCase { inspection.suggestIntSwitches = true; myFixture.enableInspections(inspection); myRelativePath = "migration/if_can_be_switch_outdated"; - myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.IF, PsiKeywords.SWITCH); + myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.IF, JavaKeywords.SWITCH); } @Override diff --git a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixTest.java b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixTest.java index 16192b896d93..5b742863abfa 100644 --- a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixTest.java +++ b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchFixTest.java @@ -2,7 +2,7 @@ package com.siyeh.ig.fixes.migration; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.testFramework.IdeaTestUtil; import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; import com.siyeh.ig.IGQuickFixesTestCase; @@ -20,7 +20,7 @@ public class IfCanBeSwitchFixTest extends IGQuickFixesTestCase { inspection.suggestIntSwitches = true; myFixture.enableInspections(inspection); myRelativePath = "migration/if_can_be_switch"; - myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.IF, PsiKeywords.SWITCH); + myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.IF, JavaKeywords.SWITCH); } @Override diff --git a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchSwitchExpressionFixTest.java b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchSwitchExpressionFixTest.java index fc4252e7ffa1..e4f99dbd13fa 100644 --- a/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchSwitchExpressionFixTest.java +++ b/java/java-tests/testSrc/com/siyeh/ig/fixes/migration/IfCanBeSwitchSwitchExpressionFixTest.java @@ -2,7 +2,7 @@ package com.siyeh.ig.fixes.migration; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.IdeaTestUtil; import com.intellij.testFramework.builders.JavaModuleFixtureBuilder; @@ -18,7 +18,7 @@ public class IfCanBeSwitchSwitchExpressionFixTest extends IGQuickFixesTestCase { inspection.suggestIntSwitches = true; myFixture.enableInspections(inspection); myRelativePath = "migration/if_can_be_switch"; - myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.IF, PsiKeywords.SWITCH); + myDefaultHint = CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.IF, JavaKeywords.SWITCH); } @Override diff --git a/java/java-tests/testSrc/com/siyeh/ipp/forloop/ReplaceForLoopWithWhileLoopFixTest.java b/java/java-tests/testSrc/com/siyeh/ipp/forloop/ReplaceForLoopWithWhileLoopFixTest.java index 279ef9f1d970..6615e862b231 100644 --- a/java/java-tests/testSrc/com/siyeh/ipp/forloop/ReplaceForLoopWithWhileLoopFixTest.java +++ b/java/java-tests/testSrc/com/siyeh/ipp/forloop/ReplaceForLoopWithWhileLoopFixTest.java @@ -2,7 +2,7 @@ package com.siyeh.ipp.forloop; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.siyeh.ig.controlflow.ForLoopReplaceableByWhileInspection; import com.siyeh.ipp.IPPTestCase; @@ -21,7 +21,7 @@ public class ReplaceForLoopWithWhileLoopFixTest extends IPPTestCase { @Override protected String getIntentionName() { - return CommonQuickFixBundle.message("fix.replace.with.x", PsiKeywords.WHILE); + return CommonQuickFixBundle.message("fix.replace.with.x", JavaKeywords.WHILE); } @Override diff --git a/java/java-tests/testSrc/com/siyeh/ipp/switchtoif/ReplaceSwitchWithIfIntentionTest.java b/java/java-tests/testSrc/com/siyeh/ipp/switchtoif/ReplaceSwitchWithIfIntentionTest.java index 4cede9e0da1d..8061f7b5adf5 100644 --- a/java/java-tests/testSrc/com/siyeh/ipp/switchtoif/ReplaceSwitchWithIfIntentionTest.java +++ b/java/java-tests/testSrc/com/siyeh/ipp/switchtoif/ReplaceSwitchWithIfIntentionTest.java @@ -2,7 +2,7 @@ package com.siyeh.ipp.switchtoif; import com.intellij.codeInspection.CommonQuickFixBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.JavaFeature; import com.intellij.pom.java.LanguageLevel; import com.intellij.testFramework.IdeaTestUtil; @@ -68,7 +68,7 @@ public class ReplaceSwitchWithIfIntentionTest extends IPPTestCase { @Override protected String getIntentionName() { - return CommonQuickFixBundle.message("fix.replace.x.with.y", PsiKeywords.SWITCH, PsiKeywords.IF); + return CommonQuickFixBundle.message("fix.replace.x.with.y", JavaKeywords.SWITCH, JavaKeywords.IF); } @Override diff --git a/java/openapi/src/com/intellij/psi/ref/AnnotationAttributeChildLink.java b/java/openapi/src/com/intellij/psi/ref/AnnotationAttributeChildLink.java index ebbe9ccb572b..0f6075cc5e9e 100644 --- a/java/openapi/src/com/intellij/psi/ref/AnnotationAttributeChildLink.java +++ b/java/openapi/src/com/intellij/psi/ref/AnnotationAttributeChildLink.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.psi.ref; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; @@ -30,7 +30,7 @@ public class AnnotationAttributeChildLink extends PsiChildLink PATTERN_CONTEXTS = List.of(DEFAULT_CONTEXT, MEMBER_CONTEXT); private static final Set PRIMITIVE_TYPES = Set.of( - PsiKeywords.SHORT, PsiKeywords.BOOLEAN, - PsiKeywords.DOUBLE, PsiKeywords.LONG, - PsiKeywords.INT, PsiKeywords.FLOAT, - PsiKeywords.CHAR, PsiKeywords.BYTE + JavaKeywords.SHORT, JavaKeywords.BOOLEAN, + JavaKeywords.DOUBLE, JavaKeywords.LONG, + JavaKeywords.INT, JavaKeywords.FLOAT, + JavaKeywords.CHAR, JavaKeywords.BYTE ); private static final Set RESERVED_WORDS = diff --git a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java index 7f6614a7b137..8f0e5a31552d 100644 --- a/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java +++ b/java/structuralsearch-java/src/com/intellij/structuralsearch/impl/matcher/compiler/JavaCompilingVisitor.java @@ -2,7 +2,7 @@ package com.intellij.structuralsearch.impl.matcher.compiler; import com.intellij.dupLocator.iterators.NodeIterator; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; @@ -43,8 +43,8 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor { private final @NotNull GlobalCompilingVisitor myCompilingVisitor; private static final @NonNls Pattern COMMENT_PATTERN = Pattern.compile("__\\$_\\w+"); - private static final Set excludedKeywords = ContainerUtil.newHashSet(PsiKeywords.CLASS, PsiKeywords.INTERFACE, PsiKeywords.ENUM, - PsiKeywords.THROWS, PsiKeywords.EXTENDS, PsiKeywords.IMPLEMENTS); + private static final Set excludedKeywords = ContainerUtil.newHashSet(JavaKeywords.CLASS, JavaKeywords.INTERFACE, JavaKeywords.ENUM, + JavaKeywords.THROWS, JavaKeywords.EXTENDS, JavaKeywords.IMPLEMENTS); public JavaCompilingVisitor(@NotNull GlobalCompilingVisitor compilingVisitor) { myCompilingVisitor = compilingVisitor; @@ -123,19 +123,19 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor { final CompileContext context = myCompilingVisitor.getContext(); if (!handleWord(aClass.getName(), CODE, context)) return; if (aClass.isInterface()) { - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.INTERFACE, true, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.INTERFACE, true, CODE, context); } else if (aClass.isEnum()) { - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.ENUM, true, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.ENUM, true, CODE, context); } else if (aClass.isRecord()) { - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.RECORD, true, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.RECORD, true, CODE, context); } else { - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.INTERFACE, false, CODE, context); - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.ENUM, false, CODE, context); - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.RECORD, false, CODE, context); - GlobalCompilingVisitor.addFilesToSearchForGivenWord(PsiKeywords.CLASS, true, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.INTERFACE, false, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.ENUM, false, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.RECORD, false, CODE, context); + GlobalCompilingVisitor.addFilesToSearchForGivenWord(JavaKeywords.CLASS, true, CODE, context); } super.visitClass(aClass); } diff --git a/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java index 27b5fd044836..778ba07c3790 100644 --- a/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java +++ b/java/typeMigration/src/com/intellij/refactoring/typeMigration/intentions/ConvertFieldToAtomicIntention.java @@ -11,7 +11,7 @@ import com.intellij.codeInsight.intention.preview.IntentionPreviewInfo; import com.intellij.ide.highlighter.JavaFileType; import com.intellij.java.codeserver.highlighting.errors.JavaCompilationError; import com.intellij.java.codeserver.highlighting.errors.JavaErrorKinds; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.java.JavaLanguage; import com.intellij.openapi.application.WriteAction; import com.intellij.openapi.diagnostic.Logger; @@ -149,7 +149,7 @@ public class ConvertFieldToAtomicIntention extends BaseElementAtCaretIntentionAc if (currentInitializer != null) return; PsiType type = var.getType(); String initializerText = PsiTypesUtil.getDefaultValueOfType(type); - if (!PsiKeywords.NULL.equals(initializerText)) { + if (!JavaKeywords.NULL.equals(initializerText)) { WriteAction.run(() -> { PsiExpression initializer = JavaPsiFacade.getElementFactory(var.getProject()).createExpressionFromText(initializerText, var); var.setInitializer(initializer); diff --git a/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java b/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java index 28a83163d26e..4672e4cd69ba 100644 --- a/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java +++ b/plugins/coverage/src/com/intellij/coverage/JavaCoverageEngine.java @@ -23,7 +23,7 @@ import com.intellij.execution.wsl.WslPath; import com.intellij.ide.BrowserUtil; import com.intellij.ide.highlighter.JavaClassFileType; import com.intellij.java.coverage.JavaCoverageBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.notification.Notification; import com.intellij.notification.NotificationAction; import com.intellij.notification.NotificationType; @@ -603,10 +603,10 @@ public class JavaCoverageEngine extends CoverageEngine { buf.append("\n").append(indent).append(preprocessExpression(expression.getExpression())); boolean reverse = expression.isReversed(); int trueHits = reverse ? jumpData.getFalseHits() : jumpData.getTrueHits(); - buf.append("\n").append(indent).append(indent).append(PsiKeywords.TRUE).append(" ").append(CoverageBundle.message("hits.message", trueHits)); + buf.append("\n").append(indent).append(indent).append(JavaKeywords.TRUE).append(" ").append(CoverageBundle.message("hits.message", trueHits)); int falseHits = reverse ? jumpData.getTrueHits() : jumpData.getFalseHits(); - buf.append("\n").append(indent).append(indent).append(PsiKeywords.FALSE).append(" ").append(CoverageBundle.message("hits.message", falseHits)); + buf.append("\n").append(indent).append(indent).append(JavaKeywords.FALSE).append(" ").append(CoverageBundle.message("hits.message", falseHits)); } private static void addSwitchDataInfo(StringBuilder buf, SwitchData switchData, SwitchCoverageExpression expression, int coverageStatus) { @@ -618,12 +618,12 @@ public class JavaCoverageEngine extends CoverageEngine { : Integer.toString(switchData.getKeys()[i]); int switchHits = switchData.getHits()[i]; allBranchesHit &= switchHits > 0; - buf.append("\n").append(indent).append(indent).append(PsiKeywords.CASE).append(" ").append(key).append(": ").append(switchHits); + buf.append("\n").append(indent).append(indent).append(JavaKeywords.CASE).append(" ").append(key).append(": ").append(switchHits); } int defaultHits = switchData.getDefaultHits(); boolean defaultCausesLinePartiallyCovered = allBranchesHit && coverageStatus != LineCoverage.FULL; if (expression.getHasDefault() || defaultCausesLinePartiallyCovered || defaultHits > 0) { - buf.append("\n").append(indent).append(indent).append(PsiKeywords.DEFAULT).append(": ").append(defaultHits); + buf.append("\n").append(indent).append(indent).append(JavaKeywords.DEFAULT).append(": ").append(defaultHits); } } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrRangeType.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrRangeType.java index f3e1d461736c..69ebd09dbb2a 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrRangeType.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GrRangeType.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.groovy.lang.psi.impl; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; import com.intellij.psi.search.GlobalSearchScope; @@ -72,9 +72,9 @@ public class GrRangeType extends GrLiteralClassType { @Override public @NotNull String getInternalCanonicalText() { return "[" + - (myLeft == null ? PsiKeywords.NULL : myLeft.getInternalCanonicalText()) + + (myLeft == null ? JavaKeywords.NULL : myLeft.getInternalCanonicalText()) + ".." + - (myRight == null ? PsiKeywords.NULL : myRight.getInternalCanonicalText()) + + (myRight == null ? JavaKeywords.NULL : myRight.getInternalCanonicalText()) + "]"; } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java index ae0469bd537c..e8700d04184e 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/GroovyPsiElementFactoryImpl.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.groovy.lang.psi.impl; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; @@ -311,7 +311,7 @@ public final class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory { if (!(type instanceof PsiArrayType)) { final String canonical = type.getCanonicalText(); final String text = canonical != null ? canonical : type.getPresentableText(); - if (PsiKeywords.NULL.equals(text)) { + if (JavaKeywords.NULL.equals(text)) { return ""; } else { @@ -503,7 +503,7 @@ public final class GroovyPsiElementFactoryImpl extends GroovyPsiElementFactory { @Override public @NotNull GrMethod createMethodFromSignature(@NotNull String name, @NotNull GrSignature signature) { - StringBuilder builder = new StringBuilder(PsiKeywords.PUBLIC); + StringBuilder builder = new StringBuilder(JavaKeywords.PUBLIC); final PsiType returnType = signature.getReturnType(); if (returnType != null && returnType != PsiTypes.nullType()) { builder.append(' '); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java index cd8881f6f54d..c4396e4ee5b5 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/GrThrowsClauseImpl.java @@ -1,9 +1,12 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; -import com.intellij.psi.*; +import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiClassType; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiJavaCodeReferenceElement; import com.intellij.psi.impl.PsiManagerEx; import com.intellij.psi.impl.light.LightClassReference; import com.intellij.psi.tree.IElementType; @@ -76,7 +79,7 @@ public class GrThrowsClauseImpl extends GrReferenceListImpl implements GrThrowsC public PsiElement add(@NotNull PsiElement element) throws IncorrectOperationException { if (element instanceof GrCodeReferenceElement || element instanceof PsiJavaCodeReferenceElement) { if (findChildByClass(GrCodeReferenceElement.class) == null) { - getNode().addLeaf(GroovyTokenTypes.kTHROWS, PsiKeywords.THROWS, null); + getNode().addLeaf(GroovyTokenTypes.kTHROWS, JavaKeywords.THROWS, null); } else { PsiElement lastChild = getLastChild(); diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt index 72d55dcb4356..e9579b3ccb60 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt @@ -1,9 +1,12 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.groovy.lang.psi.impl -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.openapi.util.Key -import com.intellij.psi.* +import com.intellij.psi.PsiClass +import com.intellij.psi.PsiElement +import com.intellij.psi.PsiRecursiveElementWalkingVisitor +import com.intellij.psi.PsiType import com.intellij.psi.stubs.StubElement import com.intellij.psi.util.CachedValue import com.intellij.psi.util.CachedValueProvider.Result @@ -175,5 +178,5 @@ fun GrVariable.isDeclaredIn(block: GrControlFlowOwner): Boolean { fun isThisRef(expression: GrExpression?): Boolean { return expression is GrReferenceExpression && expression.qualifier == null && - PsiKeywords.THIS == expression.referenceName + JavaKeywords.THIS == expression.referenceName } diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/contributor/SyntheticKeywordConstructorContributor.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/contributor/SyntheticKeywordConstructorContributor.kt index 840ce1acdee4..e784d32a4281 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/contributor/SyntheticKeywordConstructorContributor.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/ast/contributor/SyntheticKeywordConstructorContributor.kt @@ -1,10 +1,10 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.plugins.groovy.lang.resolve.ast.contributor +import com.intellij.java.syntax.parser.JavaKeywords.SUPER import com.intellij.psi.PsiAnnotation import com.intellij.psi.PsiClass import com.intellij.psi.PsiElement -import com.intellij.java.syntax.parser.PsiKeywords.SUPER import com.intellij.psi.ResolveState import com.intellij.psi.scope.ElementClassHint import com.intellij.psi.scope.PsiScopeProcessor diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/imports/unusedImports.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/imports/unusedImports.kt index aa404adc8f36..3de3d11ea6fd 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/imports/unusedImports.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/resolve/imports/unusedImports.kt @@ -3,8 +3,8 @@ package org.jetbrains.plugins.groovy.lang.resolve.imports +import com.intellij.java.syntax.parser.JavaKeywords.SUPER import com.intellij.psi.PsiElement -import com.intellij.java.syntax.parser.PsiKeywords.SUPER import com.intellij.psi.PsiRecursiveElementWalkingVisitor import org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement import org.jetbrains.plugins.groovy.lang.psi.GroovyFile diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java index 65a56ea50ebc..7e39ece83401 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyCompletionData.java @@ -8,7 +8,7 @@ import com.intellij.codeInsight.completion.*; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementBuilder; import com.intellij.codeInsight.lookup.TailTypeDecorator; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.ASTNode; import com.intellij.patterns.ElementPattern; import com.intellij.patterns.PsiElementPattern; @@ -121,31 +121,31 @@ public final class GroovyCompletionData { if (parent instanceof GrExpression && parent.getParent() instanceof GrAnnotationNameValuePair) { - addKeywords(consumer, false, PsiKeywords.TRUE, PsiKeywords.FALSE, PsiKeywords.NULL); + addKeywords(consumer, false, JavaKeywords.TRUE, JavaKeywords.FALSE, JavaKeywords.NULL); return; } if (afterAtInType(position)) { - consumer.consume(keyword(PsiKeywords.INTERFACE, TailTypes.humbleSpaceBeforeWordType())); + consumer.consume(keyword(JavaKeywords.INTERFACE, TailTypes.humbleSpaceBeforeWordType())); } if (!psiElement().afterLeaf(".", ".&", "@", "*.", "?.").accepts(position)) { if (afterAbstractMethod(position, false, true)) { - consumer.consume(keyword(PsiKeywords.THROWS, TailTypes.humbleSpaceBeforeWordType())); + consumer.consume(keyword(JavaKeywords.THROWS, TailTypes.humbleSpaceBeforeWordType())); if (afterAbstractMethod(position, false, false)) return; } if (suggestPackage(position)) { - consumer.consume(keyword(PsiKeywords.PACKAGE, TailTypes.humbleSpaceBeforeWordType())); + consumer.consume(keyword(JavaKeywords.PACKAGE, TailTypes.humbleSpaceBeforeWordType())); } if (suggestImport(position)) { - consumer.consume(keyword(PsiKeywords.IMPORT, TailTypes.humbleSpaceBeforeWordType())); + consumer.consume(keyword(JavaKeywords.IMPORT, TailTypes.humbleSpaceBeforeWordType())); } addTypeDefinitionKeywords(consumer, position); if (isAfterAnnotationMethodIdentifier(position)) { - consumer.consume(keyword(PsiKeywords.DEFAULT, TailTypes.humbleSpaceBeforeWordType())); + consumer.consume(keyword(JavaKeywords.DEFAULT, TailTypes.humbleSpaceBeforeWordType())); } addExtendsForTypeParams(position, consumer); @@ -153,10 +153,10 @@ public final class GroovyCompletionData { registerControlCompletion(position, consumer); if (parent instanceof GrExpression || isInfixOperatorPosition(position)) { - addKeywords(consumer, false, PsiKeywords.TRUE, PsiKeywords.FALSE, PsiKeywords.NULL, PsiKeywords.SUPER, PsiKeywords.THIS); - consumer.consume(keyword(PsiKeywords.NEW, TailTypes.humbleSpaceBeforeWordType())); + addKeywords(consumer, false, JavaKeywords.TRUE, JavaKeywords.FALSE, JavaKeywords.NULL, JavaKeywords.SUPER, JavaKeywords.THIS); + consumer.consume(keyword(JavaKeywords.NEW, TailTypes.humbleSpaceBeforeWordType())); if (GroovyConfigUtils.isAtLeastGroovy40(position)) { - consumer.consume(keyword(PsiKeywords.SWITCH, JavaTailTypes.SWITCH_LPARENTH)); + consumer.consume(keyword(JavaKeywords.SWITCH, JavaTailTypes.SWITCH_LPARENTH)); } } @@ -165,7 +165,7 @@ public final class GroovyCompletionData { consumer.consume(keyword("in", TailTypes.humbleSpaceBeforeWordType())); } if (isInfixOperatorPosition(position)) { - addKeywords(consumer, true, "as", "in", PsiKeywords.INSTANCEOF); + addKeywords(consumer, true, "as", "in", JavaKeywords.INSTANCEOF); } if (suggestPrimitiveTypes(position)) { final boolean addSpace = !IN_CAST_TYPE_ELEMENT.accepts(position) && @@ -177,20 +177,20 @@ public final class GroovyCompletionData { if (GroovyConfigUtils.isAtLeastGroovy40(position) && PsiJavaPatterns.psiElement(GrReferenceExpression.class).inside( PsiJavaPatterns.psiElement(GrCaseSection.class)).accepts(parent)) { - addKeywords(consumer, true, PsiKeywords.YIELD); + addKeywords(consumer, true, JavaKeywords.YIELD); } if (PsiJavaPatterns.psiElement(GrReferenceExpression.class).inside( StandardPatterns.or(PsiJavaPatterns.psiElement(GrWhileStatement.class), PsiJavaPatterns.psiElement(GrForStatement.class))).accepts(parent)) { - addKeywords(consumer, false, PsiKeywords.BREAK, PsiKeywords.CONTINUE); + addKeywords(consumer, false, JavaKeywords.BREAK, JavaKeywords.CONTINUE); } else if (PsiJavaPatterns.psiElement(GrReferenceExpression.class).inside(GrCaseSection.class).accepts(parent)) { - addKeywords(consumer, false, PsiKeywords.BREAK); + addKeywords(consumer, false, JavaKeywords.BREAK); } if (PsiJavaPatterns.psiElement().withSuperParent(2, GrImportStatement.class).accepts(position)) { - if (PsiJavaPatterns.psiElement().afterLeaf(PsiKeywords.IMPORT).accepts(position)) { - addKeywords(consumer, true, PsiKeywords.STATIC); + if (PsiJavaPatterns.psiElement().afterLeaf(JavaKeywords.IMPORT).accepts(position)) { + addKeywords(consumer, true, JavaKeywords.STATIC); } } else { if (suggestModifiers(position)) { @@ -198,11 +198,11 @@ public final class GroovyCompletionData { } if (PsiJavaPatterns.psiElement().afterLeaf(MODIFIERS).accepts(position) || GroovyCompletionUtil.isInTypeDefinitionBody(position) && GroovyCompletionUtil.isNewStatement(position, true)) { - addKeywords(consumer, true, PsiKeywords.SYNCHRONIZED); + addKeywords(consumer, true, JavaKeywords.SYNCHRONIZED); } if (suggestFinalDef(position) || PsiJavaPatterns .psiElement().afterLeaf(PsiJavaPatterns.psiElement().withText("(").withParent(GrForStatement.class)).accepts(position)) { - addKeywords(consumer, true, PsiKeywords.FINAL, "def"); + addKeywords(consumer, true, JavaKeywords.FINAL, "def"); } } } @@ -235,7 +235,7 @@ public final class GroovyCompletionData { private static void addExtendsForTypeParams(PsiElement position, GroovyCompletionConsumer consumer) { if (GroovyCompletionUtil.isWildcardCompletion(position)) { - addKeywords(consumer, true, PsiKeywords.EXTENDS, PsiKeywords.SUPER); + addKeywords(consumer, true, JavaKeywords.EXTENDS, JavaKeywords.SUPER); } } @@ -252,13 +252,13 @@ public final class GroovyCompletionData { PsiModifierList modifierList = ModifierChooser.findModifierList(position); addKeywords(result, true, ModifierChooser.addMemberModifiers(modifierList, scope != null && scope.isInterface(), position)); if (GroovyConfigUtils.isAtLeastGroovy40(position)) { - addKeywords(result, true, PsiKeywords.SEALED, PsiKeywords.NON_SEALED); + addKeywords(result, true, JavaKeywords.SEALED, JavaKeywords.NON_SEALED); } } private static void addTypeDefinitionKeywords(GroovyCompletionConsumer result, PsiElement position) { if (suggestClassInterfaceEnum(position)) { - addKeywords(result, true, PsiKeywords.CLASS, PsiKeywords.INTERFACE, PsiKeywords.ENUM, PsiKeywords.RECORD, GroovyTokenTypes.kTRAIT.toString()); + addKeywords(result, true, JavaKeywords.CLASS, JavaKeywords.INTERFACE, JavaKeywords.ENUM, JavaKeywords.RECORD, GroovyTokenTypes.kTRAIT.toString()); } } @@ -307,13 +307,13 @@ public final class GroovyCompletionData { } List keywords = new ArrayList<>(); if (ext) { - keywords.add(PsiKeywords.EXTENDS); + keywords.add(JavaKeywords.EXTENDS); } if (impl) { - keywords.add(PsiKeywords.IMPLEMENTS); + keywords.add(JavaKeywords.IMPLEMENTS); } if (permits && GroovyConfigUtils.isAtLeastGroovy40(context)) { - keywords.add(PsiKeywords.PERMITS); + keywords.add(JavaKeywords.PERMITS); } return ArrayUtil.toStringArray(keywords); @@ -332,14 +332,14 @@ public final class GroovyCompletionData { private static void registerControlCompletion(PsiElement context, GroovyCompletionConsumer result) { if (isControlStructure(context)) { - result.consume(keyword(PsiKeywords.TRY, JavaTailTypes.TRY_LBRACE)); - result.consume(keyword(PsiKeywords.WHILE, JavaTailTypes.WHILE_LPARENTH)); - result.consume(keyword(PsiKeywords.SWITCH, JavaTailTypes.SWITCH_LPARENTH)); - result.consume(keyword(PsiKeywords.FOR, JavaTailTypes.FOR_LPARENTH)); - result.consume(keyword(PsiKeywords.THROW, TailTypes.humbleSpaceBeforeWordType())); - result.consume(keyword(PsiKeywords.ASSERT, TailTypes.humbleSpaceBeforeWordType())); - result.consume(keyword(PsiKeywords.SYNCHRONIZED, JavaTailTypes.SYNCHRONIZED_LPARENTH)); - result.consume(keyword(PsiKeywords.RETURN, hasReturnValue(context) ? TailTypes.humbleSpaceBeforeWordType() : TailTypes.noneType())); + result.consume(keyword(JavaKeywords.TRY, JavaTailTypes.TRY_LBRACE)); + result.consume(keyword(JavaKeywords.WHILE, JavaTailTypes.WHILE_LPARENTH)); + result.consume(keyword(JavaKeywords.SWITCH, JavaTailTypes.SWITCH_LPARENTH)); + result.consume(keyword(JavaKeywords.FOR, JavaTailTypes.FOR_LPARENTH)); + result.consume(keyword(JavaKeywords.THROW, TailTypes.humbleSpaceBeforeWordType())); + result.consume(keyword(JavaKeywords.ASSERT, TailTypes.humbleSpaceBeforeWordType())); + result.consume(keyword(JavaKeywords.SYNCHRONIZED, JavaTailTypes.SYNCHRONIZED_LPARENTH)); + result.consume(keyword(JavaKeywords.RETURN, hasReturnValue(context) ? TailTypes.humbleSpaceBeforeWordType() : TailTypes.noneType())); } if (inCaseSection(context)) { boolean isArrowAllowed = GroovyConfigUtils.isAtLeastGroovy40(context); @@ -348,20 +348,20 @@ public final class GroovyCompletionData { result.consume(keyword("default", defaultType)); } if (afterTry(context)) { - result.consume(keyword(PsiKeywords.CATCH, JavaTailTypes.CATCH_LPARENTH)); - result.consume(keyword(PsiKeywords.FINALLY, JavaTailTypes.FINALLY_LBRACE)); + result.consume(keyword(JavaKeywords.CATCH, JavaTailTypes.CATCH_LPARENTH)); + result.consume(keyword(JavaKeywords.FINALLY, JavaTailTypes.FINALLY_LBRACE)); } if (afterIfOrElse(context)) { - result.consume(keyword(PsiKeywords.ELSE, TailTypes.humbleSpaceBeforeWordType())); + result.consume(keyword(JavaKeywords.ELSE, TailTypes.humbleSpaceBeforeWordType())); } if (WHILE_KEYWORD_POSITION.accepts(context)) { - result.consume(keyword(PsiKeywords.WHILE, JavaTailTypes.WHILE_LPARENTH)); + result.consume(keyword(JavaKeywords.WHILE, JavaTailTypes.WHILE_LPARENTH)); } if (isCommandCallWithOneArg(context)) { - result.consume(keyword(PsiKeywords.ASSERT, TailTypes.humbleSpaceBeforeWordType())); + result.consume(keyword(JavaKeywords.ASSERT, TailTypes.humbleSpaceBeforeWordType())); if (hasReturnValue(context)) { - result.consume(keyword(PsiKeywords.RETURN, TailTypes.humbleSpaceBeforeWordType())); + result.consume(keyword(JavaKeywords.RETURN, TailTypes.humbleSpaceBeforeWordType())); } } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyReferenceCharFilter.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyReferenceCharFilter.java index 5f61dbde4109..b6b3d2f49968 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyReferenceCharFilter.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/GroovyReferenceCharFilter.java @@ -4,9 +4,12 @@ package org.jetbrains.plugins.groovy.lang.completion; import com.intellij.codeInsight.lookup.CharFilter; import com.intellij.codeInsight.lookup.Lookup; import com.intellij.codeInsight.lookup.LookupElement; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.patterns.PsiJavaPatterns; -import com.intellij.psi.*; +import com.intellij.psi.PsiClass; +import com.intellij.psi.PsiDocumentManager; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.groovy.GroovyLanguage; import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor; @@ -52,7 +55,7 @@ public final class GroovyReferenceCharFilter extends CharFilter { if (c == '[' || c == ']' || c == ')' || c == '>') return CharFilter.Result.SELECT_ITEM_AND_FINISH_LOOKUP; if (c == '<' && item.getObject() instanceof PsiClass) return Result.SELECT_ITEM_AND_FINISH_LOOKUP; - if (c == '(' && PsiKeywords.RETURN.equals(item.getLookupString())) { + if (c == '(' && JavaKeywords.RETURN.equals(item.getLookupString())) { return Result.HIDE_LOOKUP; } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/weighers/GrKindWeigher.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/weighers/GrKindWeigher.java index e0882c1170f0..0f2bfaacef93 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/weighers/GrKindWeigher.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/completion/weighers/GrKindWeigher.java @@ -6,13 +6,12 @@ import com.intellij.codeInsight.completion.CompletionLocation; import com.intellij.codeInsight.completion.CompletionWeigher; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.PsiTypeLookupItem; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.psi.*; import com.intellij.psi.impl.light.LightElement; import com.intellij.psi.util.InheritanceUtil; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.containers.ContainerUtil; -import java.util.HashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor; import org.jetbrains.plugins.groovy.lang.completion.GrMainCompletionProvider; @@ -26,6 +25,7 @@ import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.annotation.GrAnnotat import org.jetbrains.plugins.groovy.lang.psi.util.GroovyCommonClassNames; import org.jetbrains.plugins.groovy.lang.psi.util.GroovyPropertyUtils; +import java.util.HashSet; import java.util.Set; /** @@ -34,9 +34,9 @@ import java.util.Set; public final class GrKindWeigher extends CompletionWeigher { private static final Set TRASH_CLASSES = new HashSet<>(10); private static final Set PRIORITY_KEYWORDS = ContainerUtil.newHashSet( - PsiKeywords.RETURN, PsiKeywords.INSTANCEOF, "in", - PsiKeywords.PRIVATE, PsiKeywords.PROTECTED, PsiKeywords.PUBLIC, PsiKeywords.STATIC, "def", - PsiKeywords.TRUE, PsiKeywords.FALSE, PsiKeywords.NULL); + JavaKeywords.RETURN, JavaKeywords.INSTANCEOF, "in", + JavaKeywords.PRIVATE, JavaKeywords.PROTECTED, JavaKeywords.PUBLIC, JavaKeywords.STATIC, "def", + JavaKeywords.TRUE, JavaKeywords.FALSE, JavaKeywords.NULL); static { TRASH_CLASSES.add(CommonClassNames.JAVA_LANG_CLASS); diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureFromMethodProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureFromMethodProcessor.java index e505a04373e3..6bff70366a94 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureFromMethodProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/extract/closure/ExtractClosureFromMethodProcessor.java @@ -2,7 +2,7 @@ package org.jetbrains.plugins.groovy.refactoring.extract.closure; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; @@ -86,7 +86,7 @@ public class ExtractClosureFromMethodProcessor extends ExtractClosureProcessorBa if (!PsiTreeUtil.isAncestor(myMethod.getContainingClass(), usageInfo.getElement(), false)) { conflicts.putValue(statements[0], JavaRefactoringBundle .message("parameter.initializer.contains.0.but.not.all.calls.to.method.are.in.its.class", - CommonRefactoringUtil.htmlEmphasize(PsiKeywords.SUPER))); + CommonRefactoringUtil.htmlEmphasize(JavaKeywords.SUPER))); break; } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java index 8dd0df6d0366..36ed1c218c3c 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceClosureParameterProcessor.java @@ -3,7 +3,7 @@ package org.jetbrains.plugins.groovy.refactoring.introduce.parameter; import com.intellij.codeInsight.ChangeContextUtil; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.findUsages.DescriptiveNameUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; @@ -126,7 +126,7 @@ public class GrIntroduceClosureParameterProcessor extends BaseRefactoringProcess if (!PsiTreeUtil.isAncestor(containingClass, usageInfo.getElement(), false)) { conflicts.putValue(expression, JavaRefactoringBundle .message("parameter.initializer.contains.0.but.not.all.calls.to.method.are.in.its.class", CommonRefactoringUtil.htmlEmphasize( - PsiKeywords.SUPER))); + JavaKeywords.SUPER))); break; } } diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java index c80f51bd3a6a..25ea55a4cbe8 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/refactoring/introduce/parameter/GrIntroduceParameterProcessor.java @@ -2,7 +2,7 @@ package org.jetbrains.plugins.groovy.refactoring.introduce.parameter; import com.intellij.java.refactoring.JavaRefactoringBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.findUsages.DescriptiveNameUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; @@ -109,7 +109,7 @@ public final class GrIntroduceParameterProcessor extends BaseRefactoringProcesso if (!PsiTreeUtil.isAncestor(toReplaceIn.getContainingClass(), usageInfo.getElement(), false)) { conflicts.putValue(mySettings.getExpression(), JavaRefactoringBundle.message("parameter.initializer.contains.0.but.not.all.calls.to.method.are.in.its.class", - CommonRefactoringUtil.htmlEmphasize(PsiKeywords.SUPER))); + CommonRefactoringUtil.htmlEmphasize(JavaKeywords.SUPER))); break; } } diff --git a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/SystemBuilder.java b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/SystemBuilder.java index 75464bb92940..19deb79ddeb5 100644 --- a/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/SystemBuilder.java +++ b/plugins/rareJavaRefactorings/src/com/intellij/refactoring/typeCook/deductive/builder/SystemBuilder.java @@ -2,7 +2,7 @@ package com.intellij.refactoring.typeCook.deductive.builder; import com.intellij.ide.highlighter.JavaFileType; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; @@ -340,11 +340,11 @@ public class SystemBuilder { else { LOG.assertTrue(expr instanceof PsiMethodCallExpression); //either this(); or super(); final PsiReferenceExpression methodExpression = ((PsiMethodCallExpression)expr).getMethodExpression(); - if (PsiKeywords.THIS.equals(methodExpression.getText())) { + if (JavaKeywords.THIS.equals(methodExpression.getText())) { aType = JavaPsiFacade.getElementFactory(myManager.getProject()).createType(aClass); } else { - LOG.assertTrue(PsiKeywords.SUPER.equals(methodExpression.getText())); + LOG.assertTrue(JavaKeywords.SUPER.equals(methodExpression.getText())); PsiClass placeClass = PsiTreeUtil.getParentOfType(expr, PsiClass.class); qualifierSubstitutor = TypeConversionUtil.getClassSubstitutor(aClass, placeClass, PsiSubstitutor.EMPTY); aType = JavaPsiFacade.getElementFactory(myManager.getProject()).createType(aClass, qualifierSubstitutor); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java b/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java index e2056c44b3d4..ae0c018749ba 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/make/FormSourceCodeGenerator.java @@ -2,7 +2,7 @@ package com.intellij.uiDesigner.make; import com.intellij.DynamicBundle; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.lang.java.JavaParserDefinition; import com.intellij.lexer.Lexer; import com.intellij.openapi.application.ApplicationManager; @@ -66,7 +66,7 @@ public final class FormSourceCodeGenerator { private static final ElementPattern ourSuperCallPattern = PsiJavaPatterns.psiExpressionStatement().withFirstChild( - PlatformPatterns.psiElement(PsiMethodCallExpression.class).withFirstChild(PlatformPatterns.psiElement().withText(PsiKeywords.SUPER))); + PlatformPatterns.psiElement(PsiMethodCallExpression.class).withFirstChild(PlatformPatterns.psiElement().withText(JavaKeywords.SUPER))); static { ourComponentLayoutCodeGenerators.put(LwSplitPane.class, new SplitPaneLayoutSourceGenerator()); diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/make/TabbedPaneLayoutSourceGenerator.java b/plugins/ui-designer/src/com/intellij/uiDesigner/make/TabbedPaneLayoutSourceGenerator.java index ebf0c1da485b..9ab6a00e2ba4 100644 --- a/plugins/ui-designer/src/com/intellij/uiDesigner/make/TabbedPaneLayoutSourceGenerator.java +++ b/plugins/ui-designer/src/com/intellij/uiDesigner/make/TabbedPaneLayoutSourceGenerator.java @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.uiDesigner.make; -import com.intellij.java.syntax.parser.PsiKeywords; +import com.intellij.java.syntax.parser.JavaKeywords; import com.intellij.uiDesigner.lw.LwComponent; import com.intellij.uiDesigner.lw.LwTabbedPane; @@ -21,7 +21,7 @@ public class TabbedPaneLayoutSourceGenerator extends LayoutSourceGenerator { generator.push(tabConstraints.myTitle); if (tabConstraints.myIcon != null || tabConstraints.myToolTip != null) { if (tabConstraints.myIcon == null) { - generator.pushVar(PsiKeywords.NULL); + generator.pushVar(JavaKeywords.NULL); } else { generator.pushIcon(tabConstraints.myIcon); diff --git a/uast/uast-java/src/org/jetbrains/uast/java/JavaUastLanguagePlugin.kt b/uast/uast-java/src/org/jetbrains/uast/java/JavaUastLanguagePlugin.kt index 0f49ccfb2e32..2226d9d2d041 100644 --- a/uast/uast-java/src/org/jetbrains/uast/java/JavaUastLanguagePlugin.kt +++ b/uast/uast-java/src/org/jetbrains/uast/java/JavaUastLanguagePlugin.kt @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast.java -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.lang.Language import com.intellij.lang.java.JavaLanguage import com.intellij.psi.* @@ -22,7 +22,6 @@ import org.jetbrains.uast.analysis.UastAnalysisPlugin import org.jetbrains.uast.java.JavaConverter.convertPsiElement import org.jetbrains.uast.java.declarations.JavaLazyParentUIdentifier import org.jetbrains.uast.java.expressions.* -import org.jetbrains.uast.java.expressions.JavaUModuleReferenceExpression import org.jetbrains.uast.util.ClassSet import org.jetbrains.uast.util.ClassSetsWrapper @@ -388,7 +387,7 @@ internal object JavaConverter { } override fun visitKeyword(keyword: PsiKeyword) { - result = if (keyword.text == PsiKeywords.SUPER || keyword.text == PsiKeywords.THIS) requiredType.el(keyword, givenParent, ::JavaLazyParentUIdentifier) else null + result = if (keyword.text == JavaKeywords.SUPER || keyword.text == JavaKeywords.THIS) requiredType.el(keyword, givenParent, ::JavaLazyParentUIdentifier) else null } override fun visitModuleReferenceElement(refElement: PsiJavaModuleReferenceElement) { diff --git a/uast/uast-java/src/org/jetbrains/uast/java/expressions/javaUCallExpressions.kt b/uast/uast-java/src/org/jetbrains/uast/java/expressions/javaUCallExpressions.kt index 5c01323ff5d8..ef631d7f716d 100644 --- a/uast/uast-java/src/org/jetbrains/uast/java/expressions/javaUCallExpressions.kt +++ b/uast/uast-java/src/org/jetbrains/uast/java/expressions/javaUCallExpressions.kt @@ -1,7 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package org.jetbrains.uast.java -import com.intellij.java.syntax.parser.PsiKeywords +import com.intellij.java.syntax.parser.JavaKeywords import com.intellij.psi.* import com.intellij.psi.util.PsiTreeUtil import com.intellij.psi.util.PsiTypesUtil @@ -24,7 +24,7 @@ class JavaUCallExpression( override val kind: UastCallKind get() { val element = nameReferenceElement - if (element is PsiKeyword && (element.text == PsiKeywords.THIS || element.text == PsiKeywords.SUPER)) + if (element is PsiKeyword && (element.text == JavaKeywords.THIS || element.text == JavaKeywords.SUPER)) return UastCallKind.CONSTRUCTOR_CALL return UastCallKind.METHOD_CALL