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());
}
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);
}
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;
}
});
}
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);
}
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());
}
}
Aggregations