Search in sources :

Example 16 with UnusedDeclarationInspection

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

the class Java8RegressionTest method setUp.

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

Example 17 with UnusedDeclarationInspection

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

the class UnusedMethodParameterTest method doTest.

private void doTest() throws Exception {
    UnusedDeclarationInspection declarationInspection = new UnusedDeclarationInspection();
    declarationInspection.getSharedLocalInspectionTool().LOCAL_VARIABLE = false;
    doTest("unusedMethodParameter/" + getTestName(true), declarationInspection);
}
Also used : UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 18 with UnusedDeclarationInspection

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

the class RedundantSuppressTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    myInspectionToolWrappers = new InspectionToolWrapper[] { new LocalInspectionToolWrapper(new JavaDocReferenceInspection()), new LocalInspectionToolWrapper(new I18nInspection()), new LocalInspectionToolWrapper(new RawUseOfParameterizedTypeInspection()), new GlobalInspectionToolWrapper(new EmptyMethodInspection()), new GlobalInspectionToolWrapper(new UnusedDeclarationInspection()) };
    myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection() {

        @NotNull
        @Override
        protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
            return myInspectionToolWrappers;
        }
    });
}
Also used : JavaDocReferenceInspection(com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection) GlobalInspectionToolWrapper(com.intellij.codeInspection.ex.GlobalInspectionToolWrapper) I18nInspection(com.intellij.codeInspection.i18n.I18nInspection) RawUseOfParameterizedTypeInspection(com.siyeh.ig.migration.RawUseOfParameterizedTypeInspection) EmptyMethodInspection(com.intellij.codeInspection.emptyMethod.EmptyMethodInspection) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection) NotNull(org.jetbrains.annotations.NotNull) GlobalInspectionToolWrapper(com.intellij.codeInspection.ex.GlobalInspectionToolWrapper) InspectionToolWrapper(com.intellij.codeInspection.ex.InspectionToolWrapper) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper) PsiElement(com.intellij.psi.PsiElement)

Example 19 with UnusedDeclarationInspection

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

the class AndroidJavaHighlightingTest method testUnusedConstructors.

public void testUnusedConstructors() throws Exception {
    // Regression test for https://code.google.com/p/android/issues/detail?id=77054
    // Checks that various constructors are not marked as unused
    final UnusedDeclarationInspection inspection = new UnusedDeclarationInspection(true);
    myFixture.enableInspections(inspection);
    final VirtualFile f = myFixture.copyFileToProject(BASE_PATH + getTestName(false) + ".java", "src/p1/p2/UnusedConstructors.java");
    myFixture.configureFromExistingVirtualFile(f);
    myFixture.checkHighlighting(true, false, true);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 20 with UnusedDeclarationInspection

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

the class OfflineInspectionResultViewTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    HighlightDisplayKey key = HighlightDisplayKey.find(UnusedDeclarationInspectionBase.SHORT_NAME);
    if (key == null) {
        HighlightDisplayKey.register(UnusedDeclarationInspectionBase.SHORT_NAME);
    }
    final InspectionProfileImpl profile = new InspectionProfileImpl("test") {

        @Override
        public boolean isToolEnabled(@Nullable final HighlightDisplayKey key, PsiElement element) {
            return key != null && Comparing.strEqual(key.toString(), UnusedDeclarationInspectionBase.SHORT_NAME);
        }

        @Override
        @NotNull
        public InspectionToolWrapper[] getInspectionTools(PsiElement element) {
            return new InspectionToolWrapper[] { myUnusedToolWrapper };
        }

        @Override
        @NotNull
        public InspectionProfileModifiableModel getModifiableModel() {
            return new InspectionProfileModifiableModel(this) {

                @Override
                @NotNull
                public InspectionToolWrapper[] getInspectionTools(PsiElement element) {
                    return new InspectionToolWrapper[] { myUnusedToolWrapper };
                }

                @Override
                public boolean isToolEnabled(@Nullable HighlightDisplayKey key, PsiElement element) {
                    return key != null && Comparing.strEqual(key.toString(), UnusedDeclarationInspectionBase.SHORT_NAME);
                }
            };
        }
    };
    myView = ViewOfflineResultsAction.showOfflineView(getProject(), parse(), profile, "");
    myUnusedToolWrapper = new GlobalInspectionToolWrapper(new UnusedDeclarationInspection());
    myDataFlowToolWrapper = new LocalInspectionToolWrapper(new EqualsWithItselfInspection());
    final Map<String, Tools> tools = myView.getGlobalInspectionContext().getTools();
    for (InspectionToolWrapper tool : ContainerUtil.ar(myUnusedToolWrapper, myDataFlowToolWrapper)) {
        profile.addTool(getProject(), tool, new THashMap<>());
        tools.put(tool.getShortName(), new ToolsImpl(tool, tool.getDefaultLevel(), true));
        tool.initialize(myView.getGlobalInspectionContext());
    }
}
Also used : HighlightDisplayKey(com.intellij.codeInsight.daemon.HighlightDisplayKey) EqualsWithItselfInspection(com.siyeh.ig.bugs.EqualsWithItselfInspection) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection) Nullable(org.jetbrains.annotations.Nullable) PsiElement(com.intellij.psi.PsiElement)

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