From 45f6d1425b07eb0127710850219e9e10880dff0b Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Thu, 30 Jun 2016 17:42:33 +0300 Subject: [PATCH] Cleanup (light "unnecessary semicolon" inspection test) --- .../UnnecessarySemicolon.java | 52 +++++++++++++++++ .../UnnecessarySemicolonInspection.java | 37 ------------ .../style/unnecessary_semicolon/expected.xml | 58 ------------------- .../UnnecessarySemicolonInspectionTest.java | 26 ++++----- 4 files changed, 62 insertions(+), 111 deletions(-) create mode 100644 plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolon.java delete mode 100644 plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolonInspection.java delete mode 100644 plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/expected.xml diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolon.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolon.java new file mode 100644 index 000000000000..b99b8ef7bd1f --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolon.java @@ -0,0 +1,52 @@ +/* + * Copyright 2000-2016 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.siyeh.igtest.style.unnecessary_semicolon;; + +import java.util.List;; + +class UnnecessarySemicolon { + int i; + ; // comment + public UnnecessarySemicolon() { + ; // this is a comment + ; /* another */ + } +} ; // comment + +enum Status { + BUSY ("BUSY" ), + DONE ("DONE" ) ; // <<---- THIS IS NOT UNNECESSARY + + public final String text; ; + private Status (String i_text) { + text = i_text; + } +} + +enum BuildType { + ; + + public String toString() { + return super.toString(); + } +} + +class C { + void m() throws Exception { + try (AutoCloseable r1 = null; AutoCloseable r2 = null /*ok*/ ) { } + try (AutoCloseable r1 = null; AutoCloseable r2 = null; /*warn*/ ) { } + } +} \ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolonInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolonInspection.java deleted file mode 100644 index 67524e40023f..000000000000 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/UnnecessarySemicolonInspection.java +++ /dev/null @@ -1,37 +0,0 @@ - -package com.siyeh.igtest.style.unnecessary_semicolon;; -import java.util.List;; -public class UnnecessarySemicolonInspection -{ - int i; - ; // comment - public UnnecessarySemicolonInspection() - { - ; // this is a comment - ; /* another */ - } -} ; // comment -enum Status -{ - BUSY ("BUSY" ), - DONE ("DONE" ) ; // <<---- THIS IS NOT UNNECESSARY - - public final String text; ; - private Status (String i_text) { - text = i_text; - } -} -enum BuildType -{ - ; - - public String toString() { - return super.toString(); - } -} -class C { - void m() throws Exception { - try (AutoCloseable r1 = null; AutoCloseable r2 = null /*ok*/ ) { } - try (AutoCloseable r1 = null; AutoCloseable r2 = null; /*warn*/ ) { } - } -} \ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/expected.xml deleted file mode 100644 index 91898089593e..000000000000 --- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_semicolon/expected.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - UnnecessarySemicolonInspection.java - 2 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 3 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 7 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 10 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 11 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 13 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 19 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - - - UnnecessarySemicolonInspection.java - 35 - Unnecessary semicolon - Unnecessary semicolon <code>;</code> #loc - - \ No newline at end of file diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java index 33c3cc8af3ce..51dc92994124 100644 --- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/style/UnnecessarySemicolonInspectionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2016 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. @@ -15,22 +15,16 @@ */ package com.siyeh.ig.style; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.impl.JavaSdkImpl; -import com.intellij.openapi.roots.LanguageLevelProjectExtension; -import com.intellij.pom.java.LanguageLevel; -import com.intellij.testFramework.IdeaTestUtil; -import com.siyeh.ig.IGInspectionTestCase; +import com.intellij.codeInspection.InspectionProfileEntry; +import com.siyeh.ig.LightInspectionTestCase; +import org.jetbrains.annotations.Nullable; -public class UnnecessarySemicolonInspectionTest extends IGInspectionTestCase { +public class UnnecessarySemicolonInspectionTest extends LightInspectionTestCase { + public void testUnnecessarySemicolon() { doTest(); } + + @Nullable @Override - protected Sdk getTestProjectSdk() { - LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_1_7); - return IdeaTestUtil.getMockJdk17(); - } - - public void test() throws Exception { - doTest("com/siyeh/igtest/style/unnecessary_semicolon", - new UnnecessarySemicolonInspection()); + protected InspectionProfileEntry getInspection() { + return new UnnecessarySemicolonInspection(); } } \ No newline at end of file