mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
disable null-argument checks in batch mode IDEA-CR-13940
This commit is contained in:
+3
-3
@@ -147,12 +147,12 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
}
|
||||
|
||||
private void analyzeNullLiteralMethodArguments(PsiMethod method, ProblemsHolder holder, boolean isOnTheFly) {
|
||||
if (REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER) {
|
||||
for (PsiParameter parameter : NullParameterConstraintChecker.checkMethodParameters(method, isOnTheFly)) {
|
||||
if (REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER && isOnTheFly) {
|
||||
for (PsiParameter parameter : NullParameterConstraintChecker.checkMethodParameters(method, true)) {
|
||||
holder.registerProblem(parameter.getNameIdentifier(),
|
||||
InspectionsBundle.message("dataflow.method.fails.with.null.argument"),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
NullableStuffInspectionBase.getWrappedUiDependentQuickFix(this::createNavigateToNullParameterUsagesFix, parameter, isOnTheFly));
|
||||
createNavigateToNullParameterUsagesFix(parameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-11
@@ -43,7 +43,6 @@ import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
// deprecated fields remain to minimize changes to users inspection profiles (which are often located in version control).
|
||||
@@ -503,15 +502,14 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
|
||||
boolean isOnFly,
|
||||
int parameterIdx,
|
||||
PsiParameter parameter) {
|
||||
if (REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER && isNotNullNotInferred(parameter, false, false)) {
|
||||
if (REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER && isOnFly && isNotNullNotInferred(parameter, false, false)) {
|
||||
PsiAnnotation notNullAnnotation = nullableManager.getNotNullAnnotation(parameter, false);
|
||||
if (JavaNullMethodArgumentUtil.hasNullArgument(method, parameterIdx)) {
|
||||
LocalQuickFix[] fixes = getWrappedUiDependentQuickFix(this::createNavigateToNullParameterUsagesFix, parameter, isOnFly);
|
||||
boolean physical = PsiTreeUtil.isAncestor(parameter, notNullAnnotation, true);
|
||||
holder.registerProblem(physical ? notNullAnnotation : parameter.getNameIdentifier(),
|
||||
InspectionsBundle.message("inspection.nullable.problems.NotNull.parameter.receives.null.literal", getPresentableAnnoName(parameter)),
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
fixes);
|
||||
createNavigateToNullParameterUsagesFix(parameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -596,13 +594,6 @@ public class NullableStuffInspectionBase extends BaseJavaBatchLocalInspectionToo
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static LocalQuickFix[] getWrappedUiDependentQuickFix(Function<PsiParameter, LocalQuickFix> fixSupplier, PsiParameter parameter, boolean isOnTheFly) {
|
||||
if (!isOnTheFly) return LocalQuickFix.EMPTY_ARRAY;
|
||||
final LocalQuickFix fix = fixSupplier.apply(parameter);
|
||||
return fix == null ? LocalQuickFix.EMPTY_ARRAY : new LocalQuickFix[]{fix};
|
||||
}
|
||||
|
||||
private static boolean isNotNullNotInferred(@NotNull PsiModifierListOwner owner, boolean checkBases, boolean skipExternal) {
|
||||
Project project = owner.getProject();
|
||||
NullableNotNullManager manager = NullableNotNullManager.getInstance(project);
|
||||
|
||||
Reference in New Issue
Block a user