Search in sources :

Example 1 with UncheckedWarningLocalInspection

use of com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection 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 };
}
Also used : UncheckedWarningLocalInspection(com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection) NotNull(org.jetbrains.annotations.NotNull) InspectionToolWrapper(com.intellij.codeInspection.ex.InspectionToolWrapper) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper) LocalInspectionToolWrapper(com.intellij.codeInspection.ex.LocalInspectionToolWrapper) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with UncheckedWarningLocalInspection

use of com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection in project intellij-community by JetBrains.

the class GraphInferenceHighlightingTest method testPartialRawSubstitutionToAvoidInferringObjectsWhenRawExpected.

public void testPartialRawSubstitutionToAvoidInferringObjectsWhenRawExpected() throws Exception {
    final UncheckedWarningLocalInspection localInspection = new UncheckedWarningLocalInspection();
    enableInspectionTool(localInspection);
    doTest(true);
}
Also used : UncheckedWarningLocalInspection(com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection)

Example 3 with UncheckedWarningLocalInspection

use of com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection in project intellij-community by JetBrains.

the class LightAdvHighlightingJdk6Test method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection());
    setLanguageLevel(LanguageLevel.JDK_1_6);
    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_6, getModule(), getTestRootDisposable());
}
Also used : RedundantCastInspection(com.intellij.codeInspection.redundantCast.RedundantCastInspection) UncheckedWarningLocalInspection(com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection) JavacQuirksInspection(com.intellij.codeInspection.compiler.JavacQuirksInspection) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 4 with UncheckedWarningLocalInspection

use of com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection in project intellij-community by JetBrains.

the class LightAdvHighlightingJdk7Test method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new JavacQuirksInspection(), new RedundantCastInspection());
    setLanguageLevel(LanguageLevel.JDK_1_7);
    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_7, getModule(), getTestRootDisposable());
}
Also used : RedundantCastInspection(com.intellij.codeInspection.redundantCast.RedundantCastInspection) UncheckedWarningLocalInspection(com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection) JavacQuirksInspection(com.intellij.codeInspection.compiler.JavacQuirksInspection) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Example 5 with UncheckedWarningLocalInspection

use of com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection in project intellij-community by JetBrains.

the class LightAdvHighlightingJdk9Test method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    enableInspectionTools(new UnusedDeclarationInspection(), new UncheckedWarningLocalInspection(), new RedundantCastInspection(), new JavaDocReferenceInspection());
    setLanguageLevel(LanguageLevel.JDK_1_9);
    IdeaTestUtil.setTestVersion(JavaSdkVersion.JDK_1_9, getModule(), getTestRootDisposable());
}
Also used : JavaDocReferenceInspection(com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection) RedundantCastInspection(com.intellij.codeInspection.redundantCast.RedundantCastInspection) UncheckedWarningLocalInspection(com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection) UnusedDeclarationInspection(com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)

Aggregations

UncheckedWarningLocalInspection (com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection)5 UnusedDeclarationInspection (com.intellij.codeInspection.deadCode.UnusedDeclarationInspection)3 RedundantCastInspection (com.intellij.codeInspection.redundantCast.RedundantCastInspection)3 JavacQuirksInspection (com.intellij.codeInspection.compiler.JavacQuirksInspection)2 InspectionToolWrapper (com.intellij.codeInspection.ex.InspectionToolWrapper)1 LocalInspectionToolWrapper (com.intellij.codeInspection.ex.LocalInspectionToolWrapper)1 JavaDocReferenceInspection (com.intellij.codeInspection.javaDoc.JavaDocReferenceInspection)1 NotNull (org.jetbrains.annotations.NotNull)1