diff --git a/java/java-frontback-psi-api/resources/messages/JavaPsiBundle.properties b/java/java-frontback-psi-api/resources/messages/JavaPsiBundle.properties index aeb253b187f2..0836aedd1dff 100644 --- a/java/java-frontback-psi-api/resources/messages/JavaPsiBundle.properties +++ b/java/java-frontback-psi-api/resources/messages/JavaPsiBundle.properties @@ -121,7 +121,7 @@ feature.stream.gatherers=Stream Gatherers feature.foreign.functions=Foreign Function & Memory API feature.virtual.threads=Virtual Threads feature.statements.before.super=Statements before super() -feature.module.imports=Module imports +feature.module.import.declarations=Module Import Declarations else.without.if='else' without 'if' enum.constant.context=Enum constant ''{0}'' in ''{1}'' diff --git a/java/java-frontback-psi-api/src/com/intellij/pom/java/JavaFeature.java b/java/java-frontback-psi-api/src/com/intellij/pom/java/JavaFeature.java index 7a601e76dcad..868e270922b9 100644 --- a/java/java-frontback-psi-api/src/com/intellij/pom/java/JavaFeature.java +++ b/java/java-frontback-psi-api/src/com/intellij/pom/java/JavaFeature.java @@ -116,7 +116,7 @@ public enum JavaFeature { IMPLICIT_IMPORT_IN_IMPLICIT_CLASSES(LanguageLevel.JDK_23_PREVIEW, "feature.implicit.import.in.implicit.classes"), PRIMITIVE_TYPES_IN_PATTERNS(LanguageLevel.JDK_23_PREVIEW, "feature.primitive.types.in.patterns"), - MODULE_IMPORTS(LanguageLevel.JDK_23_PREVIEW, "feature.module.imports"), + MODULE_IMPORT_DECLARATIONS(LanguageLevel.JDK_23_PREVIEW, "feature.module.import.declarations"), ; private final @NotNull LanguageLevel myLevel; 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 76ed249cb51c..9468597c4720 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaKeywordCompletion.java @@ -823,7 +823,7 @@ public class JavaKeywordCompletion { StreamEx.of(implicitClass.getChildren()).select(PsiMember.class).findFirst().orElse(null) == field; if (myPrevLeaf == null || bogusDeclarationInImplicitClass && file instanceof PsiJavaFile javaFile && javaFile.getPackageStatement() == null && - javaFile.getImportList() != null && javaFile.getImportList().getAllImportDeclarations().length == 0) { + javaFile.getImportList() != null && javaFile.getImportList().getAllImportStatements().length == 0) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.PACKAGE), TailTypes.humbleSpaceBeforeWordType())); addKeyword(new OverridableSpace(createKeyword(PsiKeyword.IMPORT), TailTypes.humbleSpaceBeforeWordType())); } @@ -840,7 +840,7 @@ public class JavaKeywordCompletion { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.STATIC), TailTypes.humbleSpaceBeforeWordType())); } - if (PsiUtil.isAvailable(JavaFeature.MODULE_IMPORTS, file) && myPrevLeaf != null && myPrevLeaf.textMatches(PsiKeyword.IMPORT)) { + if (PsiUtil.isAvailable(JavaFeature.MODULE_IMPORT_DECLARATIONS, file) && myPrevLeaf != null && myPrevLeaf.textMatches(PsiKeyword.IMPORT)) { addKeyword(new OverridableSpace(createKeyword(PsiKeyword.MODULE), TailTypes.humbleSpaceBeforeWordType())); } } diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java index 88df41b45de7..387567f1ee40 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/PsiImplUtil.java @@ -885,7 +885,7 @@ public final class PsiImplUtil { // import module java.base; for implicit classes if (PsiUtil.isAvailable(JavaFeature.IMPLICIT_IMPORT_IN_IMPLICIT_CLASSES, file) && - PsiUtil.isAvailable(JavaFeature.MODULE_IMPORTS, file) && + PsiUtil.isAvailable(JavaFeature.MODULE_IMPORT_DECLARATIONS, file) && file instanceof PsiJavaFile) { PsiClass[] classes = ((PsiJavaFile)file).getClasses(); if (classes.length == 1 && classes[0] instanceof PsiImplicitClass) { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java index b507562f4456..be6d85c1fad5 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/completion/KeywordCompletionTest.java @@ -188,7 +188,7 @@ public class KeywordCompletionTest extends LightCompletionTestCase { public void testImportStatic() { doTest(1, "static"); } public void testImportModule() { - setLanguageLevel(JavaFeature.MODULE_IMPORTS.getMinimumLevel()); + setLanguageLevel(JavaFeature.MODULE_IMPORT_DECLARATIONS.getMinimumLevel()); doTest(2, "static", "module"); } public void testAbstractInInterface() { doTest(1, "abstract"); }