Search in sources :

Example 6 with UnusedDeclarationInspection

use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.

the class SuppressNonInspectionsTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    enableInspectionTool(new UnusedDeclarationInspection());
}
Also used : UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 7 with UnusedDeclarationInspection

use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.

the class RemoveUnusedParameterTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    enableInspectionTool(new UnusedDeclarationInspection());
}
Also used : UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 8 with UnusedDeclarationInspection

use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.

the class RemoveUnusedVariableTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    enableInspectionTool(new UnusedDeclarationInspection());
}
Also used : UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 9 with UnusedDeclarationInspection

use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.

the class DaemonRespondToChangesTest method testUnusedMethodUpdate.

public void testUnusedMethodUpdate() throws Exception {
    configureByText(JavaFileType.INSTANCE, "class X {\n" + "    static void ffff() {}\n" + "    public static void main(String[] args){\n" + "        for (int i=0; i<1000;i++) {\n" + "            System.out.println(i);\n" + "            <caret>ffff();\n" + "        }\n" + "    }\n}");
    enableInspectionTool(new UnusedDeclarationInspection(true));
    List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
    assertEmpty(infos);
    PlatformTestUtil.invokeNamedAction(IdeActions.ACTION_COMMENT_LINE);
    infos = doHighlighting(HighlightSeverity.WARNING);
    assertEquals(1, infos.size());
    assertEquals("Method 'ffff()' is never used", infos.get(0).getDescription());
}
Also used : UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 10 with UnusedDeclarationInspection

use of com.intellij.codeInspection.deadCode.UnusedDeclarationInspection in project intellij-community by JetBrains.

the class DaemonRespondToChangesTest method testLocallyUsedFieldHighlighting.

public void testLocallyUsedFieldHighlighting() {
    configureByText(JavaFileType.INSTANCE, "class A {\n" + "    String cons;\n" + "    void foo() {\n" + "        String local = null;\n" + "        <selection>cons</selection>.substring(1);" + "    }\n" + "    public static void main(String[] args) {\n" + "        new A().foo();\n" + "    }" + "}");
    enableInspectionTool(new UnusedDeclarationInspection(true));
    List<HighlightInfo> infos = doHighlighting(HighlightSeverity.WARNING);
    assertSize(1, infos);
    assertEquals("Variable 'local' is never used", infos.get(0).getDescription());
    type("local");
    infos = doHighlighting(HighlightSeverity.WARNING);
    assertSize(1, infos);
    assertEquals("Field 'cons' is never used", infos.get(0).getDescription());
}
Also used : UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Aggregations

UnusedDeclarationInspection (com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)39 RedundantCastInspection (com.intellij.codeInspection.redundantCast.RedundantCastInspection)3 UncheckedWarningLocalInspection (com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 PsiElement (com.intellij.psi.PsiElement)3 JavacQuirksInspection (com.intellij.codeInspection.compiler.JavacQuirksInspection)2 GlobalInspectionToolWrapper (com.intellij.codeInspection.ex.GlobalInspectionToolWrapper)2 JavaDocReferenceInspection (com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection)2 NotNull (org.jetbrains.annotations.NotNull)2 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)1 InspectionEP (com.intellij.codeInspection.InspectionEP)1 UnusedDeclarationPresentation (com.intellij.codeInspection.deadCode.UnusedDeclarationPresentation)1 EmptyMethodInspection (com.intellij.codeInspection.emptyMethod.EmptyMethodInspection)1 InspectionToolWrapper (com.intellij.codeInspection.ex.InspectionToolWrapper)1 LocalInspectionToolWrapper (com.intellij.codeInspection.ex.LocalInspectionToolWrapper)1 I18nInspection (com.intellij.codeInspection.i18n.I18nInspection)1 EntryPoint (com.intellij.codeInspection.reference.EntryPoint)1 PsiField (com.intellij.psi.PsiField)1 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)1 ApplyChangeSignatureAction (com.intellij.refactoring.changeSignature.inplace.ApplyChangeSignatureAction)1