use of com.intellij.codeInspection.ex.LocalInspectionToolWrapper in project intellij-community by JetBrains.
the class RemoveRedundantUncheckedSuppressionTest method configureLocalInspectionTools.
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
final PossibleHeapPollutionVarargsInspection varargsInspection = new PossibleHeapPollutionVarargsInspection();
final UncheckedWarningLocalInspection warningLocalInspection = new UncheckedWarningLocalInspection();
final RedundantSuppressInspection inspection = new RedundantSuppressInspection() {
@NotNull
@Override
protected InspectionToolWrapper[] getInspectionTools(PsiElement psiElement, @NotNull InspectionManager manager) {
return new InspectionToolWrapper[] { new LocalInspectionToolWrapper(varargsInspection), new LocalInspectionToolWrapper(warningLocalInspection) };
}
};
return new LocalInspectionTool[] { new LocalInspectionTool() {
@Nls
@NotNull
@Override
public String getGroupDisplayName() {
return inspection.getGroupDisplayName();
}
@Nls
@NotNull
@Override
public String getDisplayName() {
return inspection.getDisplayName();
}
@NotNull
@Override
public String getShortName() {
return inspection.getShortName();
}
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) {
return new JavaElementVisitor() {
@Override
public void visitClass(PsiClass aClass) {
checkMember(aClass, inspection, holder);
}
@Override
public void visitMethod(PsiMethod method) {
checkMember(method, inspection, holder);
}
};
}
private void checkMember(PsiMember member, RedundantSuppressInspection inspection, ProblemsHolder holder) {
final ProblemDescriptor[] problemDescriptors = inspection.checkElement(member, InspectionManager.getInstance(getProject()));
if (problemDescriptors != null) {
for (ProblemDescriptor problemDescriptor : problemDescriptors) {
holder.registerProblem(problemDescriptor);
}
}
}
}, varargsInspection, warningLocalInspection };
}
use of com.intellij.codeInspection.ex.LocalInspectionToolWrapper in project intellij-community by JetBrains.
the class SSBasedInspectionTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
SSBasedInspection inspection = new SSBasedInspection();
List<Configuration> configurations = new ArrayList<>();
SearchConfiguration configuration = new SearchConfiguration();
MatchOptions options = new MatchOptions();
options.setFileType(StdFileTypes.JAVA);
options.setSearchPattern("int i;");
configuration.setMatchOptions(options);
configurations.add(configuration);
configuration = new SearchConfiguration();
options = new MatchOptions();
options.setFileType(StdFileTypes.JAVA);
options.setSearchPattern("f();");
configuration.setMatchOptions(options);
configurations.add(configuration);
inspection.setConfigurations(configurations, myProject);
myWrapper = new LocalInspectionToolWrapper(inspection);
}
use of com.intellij.codeInspection.ex.LocalInspectionToolWrapper in project intellij-community by JetBrains.
the class UnnecessaryReturnInspectionTest method test.
public void test() throws Exception {
final UnnecessaryReturnInspection inspection = new UnnecessaryReturnInspection();
inspection.ignoreInThenBranch = true;
final LanguageLevelProjectExtension levelProjectExtension = LanguageLevelProjectExtension.getInstance(getProject());
final LanguageLevel level = levelProjectExtension.getLanguageLevel();
try {
levelProjectExtension.setLanguageLevel(LanguageLevel.JDK_1_8);
doTest("com/siyeh/igtest/controlflow/unnecessary_return", new LocalInspectionToolWrapper(inspection), "java 1.8");
} finally {
levelProjectExtension.setLanguageLevel(level);
}
}
use of com.intellij.codeInspection.ex.LocalInspectionToolWrapper in project intellij-community by JetBrains.
the class InvalidPropertyKeyInspectionTest method doTest.
private void doTest() throws Exception {
LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(new InvalidPropertyKeyInspection());
doTest("invalidPropertyKey/" + getTestName(true), tool, "java 1.5");
}
use of com.intellij.codeInspection.ex.LocalInspectionToolWrapper in project intellij-community by JetBrains.
the class I18NInspectionTest method testFormTabbedPaneTitle.
public void testFormTabbedPaneTitle() throws Exception {
LocalInspectionToolWrapper wrapper = new LocalInspectionToolWrapper(new I18nFormInspection());
InspectionsKt.enableInspectionTool(getProject(), wrapper, getTestRootDisposable());
doTest("i18n/" + getTestName(true), new LocalInspectionToolWrapper(new I18nInspection()), "java 1.4", false, false, wrapper);
}
Aggregations