Java: improve inspection messages

for "Java module name contradicts convention" inspection

GitOrigin-RevId: aee175101de907aea9c6ce65a12ad1ed02513dc6
This commit is contained in:
Bas Leijdekkers
2025-04-15 08:34:10 +00:00
committed by intellij-monorepo-bot
parent e94aebcbf7
commit e90a4de2d9
3 changed files with 12 additions and 8 deletions
@@ -216,8 +216,8 @@ inspection.implicit.subclass.display.name=Final declaration can't be overridden
inspection.implicit.subclass.extendable=Make ''{0}'' overridable
inspection.implicit.subclass.make.class.extendable=Make class ''{0}'' {1,choice,0#|1#and method {2} |1<and {1} required methods }extendable
inspection.infinite.loop.option=Ignore when placed in Thread.run
inspection.java.module.naming.terminal.digits=Module name component ''{0}'' should avoid terminal digits
inspection.java.module.naming=Java module name contradicts the convention
inspection.java.module.naming.terminal.digits=Module name ''{0}'' should not use terminal digits to encode version information
inspection.java.module.naming=Java module name violates convention
inspection.java.module.definition=Java module definition problems
inspection.local.can.be.final.display.name=Local variable or parameter can be 'final'
inspection.local.can.be.final.option1=Report method parameters
@@ -1,11 +1,15 @@
<html>
<body>
Reports cases when a module name contradicts Java Platform Module System recommendations.
<p>One of the <a href="http://mail.openjdk.org/pipermail/jpms-spec-experts/2017-March/000659.html">recommendations</a>
is to avoid using digits at the end of module names.</p>
Reports module names in <code>module-info.java</code> that violate the Java Platform Module System
<a href="http://mail.openjdk.org/pipermail/jpms-spec-experts/2017-March/000659.html">recommendation</a>
to avoid encoding version information in module names by ending the name with one or more digits.
<p><b>Example:</b></p>
<pre><code>
module foo1.bar2 {}
module foo.bar2 {}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
module foo.bar {}
</code></pre>
<!-- tooltip end -->
</body>
@@ -10,9 +10,9 @@ class JavaModuleNamingTest : LightJava9ModulesCodeInsightFixtureTestCase() {
myFixture.enableInspections(JavaModuleNamingInspection())
}
fun testSimple() = highlighting("""module <warning descr="Module name component 'foo1' should avoid terminal digits">foo1</warning>.bar { }""")
fun testSimple() = highlighting("""module <warning descr="Module name 'foo1' should not use terminal digits to encode version information">foo1</warning>.bar { }""")
fun testSuppress() = highlighting("""@SuppressWarnings("module") module foo1.bar { }""")
fun testDevanagariDigitsAreBannedToo() = highlighting("""module <warning descr="Module name component 'foo१' should avoid terminal digits">foo१</warning>.bar { }""")
fun testDevanagariDigitsAreBannedToo() = highlighting("""module <warning descr="Module name 'foo१' should not use terminal digits to encode version information">foo१</warning>.bar { }""")
fun testMiddleDigitsAllowed() = highlighting("""module f0o.b4r { }""")
fun testFix() {