diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/JavaModuleNamingInspection.java b/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/JavaModuleNamingInspection.java deleted file mode 100644 index d4b905dca1f3..000000000000 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/java19modules/JavaModuleNamingInspection.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.codeInspection.java19modules; - -import com.intellij.codeInsight.intention.QuickFixFactory; -import com.intellij.codeInspection.BaseJavaLocalInspectionTool; -import com.intellij.codeInspection.InspectionsBundle; -import com.intellij.codeInspection.ProblemsHolder; -import com.intellij.psi.JavaElementVisitor; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.PsiJavaModule; -import com.intellij.psi.PsiJavaModuleReferenceElement; -import com.intellij.psi.util.PsiUtil; -import org.jetbrains.annotations.NotNull; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class JavaModuleNamingInspection extends BaseJavaLocalInspectionTool { - private final Pattern TRAILING_DIGITS = Pattern.compile("^([^0-9]+)\\d+$"); - - @NotNull - @Override - public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { - return !PsiUtil.isModuleFile(holder.getFile()) ? PsiElementVisitor.EMPTY_VISITOR : new JavaElementVisitor() { - @Override - public void visitModule(PsiJavaModule module) { - super.visitModule(module); - PsiJavaModuleReferenceElement nameElement = module.getNameIdentifier(); - String name = nameElement.getReferenceText(); - Matcher matcher = TRAILING_DIGITS.matcher(name); - if (matcher.matches()) { - String message = InspectionsBundle.message("inspection.java.module.naming.terminal.digits", name); - holder.registerProblem(nameElement, message, QuickFixFactory.getInstance().createRenameElementFix(module, matcher.group(1))); - } - } - }; - } -} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/java/codeInspection/JavaModuleNamingTest.kt b/java/java-tests/testSrc/com/intellij/java/codeInspection/JavaModuleNamingTest.kt deleted file mode 100644 index 89c9be515e24..000000000000 --- a/java/java-tests/testSrc/com/intellij/java/codeInspection/JavaModuleNamingTest.kt +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.java.codeInspection - -import com.intellij.codeInspection.java19modules.JavaModuleNamingInspection -import com.intellij.testFramework.fixtures.LightJava9ModulesCodeInsightFixtureTestCase - -class JavaModuleNamingTest : LightJava9ModulesCodeInsightFixtureTestCase() { - override fun setUp() { - super.setUp() - myFixture.enableInspections(JavaModuleNamingInspection()) - } - - fun testTerminalDigits() { - highlighting("""module foo.bar42 { }""") - fix("module foo.bar42 { }", "module foo.bar { }") - } - - fun testTerminalDigitsAndMiddleComments() { - highlighting("""module foo/*.bar*/.baz42 { }""") - } - - private fun highlighting(text: String) { - myFixture.configureByText("module-info.java", text) - myFixture.checkHighlighting() - } - - private fun fix(before: String, after: String) { - myFixture.configureByText("module-info.java", before) - myFixture.launchAction(myFixture.findSingleIntention("Rename")) - myFixture.checkResult("module-info.java", after, false) - } -} \ No newline at end of file diff --git a/platform/platform-resources-en/src/messages/InspectionsBundle.properties b/platform/platform-resources-en/src/messages/InspectionsBundle.properties index 0fe669492232..08642f0642b9 100644 --- a/platform/platform-resources-en/src/messages/InspectionsBundle.properties +++ b/platform/platform-resources-en/src/messages/InspectionsBundle.properties @@ -767,9 +767,6 @@ inspection.module.exports.package.to.itself=Module exports/opens package to itse exports.to.itself.delete.statement.fix=Delete statement exports.to.itself.delete.module.ref.fix=Delete reference to module ''{0}'' -inspection.java.module.naming=Java module naming conventions -inspection.java.module.naming.terminal.digits=Module name ''{0}'' should avoid terminal digits - inspection.replace.with.bulk.message=Iteration can be replaced with bulk ''{0}'' call inspection.replace.with.bulk.fix.name=Replace iteration with bulk ''{0}'' call inspection.replace.with.bulk.fix.family.name=Replace with bulk method call diff --git a/resources-en/src/inspectionDescriptions/JavaModuleNaming.html b/resources-en/src/inspectionDescriptions/JavaModuleNaming.html deleted file mode 100644 index b648e70dccd2..000000000000 --- a/resources-en/src/inspectionDescriptions/JavaModuleNaming.html +++ /dev/null @@ -1,7 +0,0 @@ - - -The inspection detects situations when a module name contradicts Java Platform Module System recommendations. -
Example: -module foo.bar42 { } - - \ No newline at end of file diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index 3031760a31c9..e71741a9ed0a 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -948,10 +948,6 @@ enabledByDefault="true" level="WARNING" key="inspection.module.exports.package.to.itself" bundle="messages.InspectionsBundle" implementationClass="com.intellij.codeInspection.java19modules.Java9ModuleExportsPackageToItselfInspection"/> -