[java] unnecessary semicolons in module-info files

This commit is contained in:
Roman Shevchenko
2016-06-30 18:00:48 +03:00
parent a57358e2e3
commit 553c299b1c
3 changed files with 18 additions and 0 deletions
@@ -114,6 +114,12 @@ public class UnnecessarySemicolonInspection extends BaseInspection implements Cl
super.visitImportList(list);
}
@Override
public void visitModule(PsiJavaModule module) {
findTopLevelSemicolons(module);
super.visitModule(module);
}
private void findTopLevelSemicolons(PsiElement element) {
for (PsiElement sibling = element.getFirstChild(); sibling != null; sibling = skipForwardWhiteSpacesAndComments(sibling)) {
if (PsiUtil.isJavaToken(sibling, JavaTokenType.SEMICOLON)) {
@@ -0,0 +1,3 @@
module M {
<warning descr="Unnecessary semicolon ';'">;</warning>
}
@@ -16,11 +16,20 @@
package com.siyeh.ig.style;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.testFramework.LightProjectDescriptor;
import com.siyeh.ig.LightInspectionTestCase;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class UnnecessarySemicolonInspectionTest extends LightInspectionTestCase {
public void testUnnecessarySemicolon() { doTest(); }
public void testModuleInfo() { doNamedTest("module-info"); }
@NotNull
@Override
protected LightProjectDescriptor getProjectDescriptor() {
return JAVA_9;
}
@Nullable
@Override