tooltips for INFORMATION level: default change to 'no' (IDEA-181493)

initially one who wanted to provide some fixes without highlighting should created ProblemDescriptor manually and disable tooltip explicitly; looks like it's too tedious to teach all inspection authors to do so and all existing usages were similar: disable if INFORMATION. Let's apply as default
This commit is contained in:
Anna.Kozlova
2017-11-03 17:37:43 +01:00
parent 9d0117859f
commit 1d759e10e3
5 changed files with 13 additions and 22 deletions
@@ -93,11 +93,8 @@ public class AnonymousCanBeLambdaInspection extends AbstractBaseJavaLocalInspect
type = ProblemHighlightType.INFORMATION;
}
}
ProblemDescriptorBase descriptor = new ProblemDescriptorBase(parent, parent, "Anonymous #ref #loc can be replaced with lambda",
new LocalQuickFix[]{new ReplaceWithLambdaFix()},
type, false, rangeInElement,
type != ProblemHighlightType.INFORMATION, true);
holder.registerProblem(descriptor);
holder.registerProblem(parent, "Anonymous #ref #loc can be replaced with lambda",
type, rangeInElement, new ReplaceWithLambdaFix());
}
}
};
@@ -88,12 +88,9 @@ public class AnonymousCanBeMethodReferenceInspection extends AbstractBaseJavaLoc
ProblemHighlightType type = methodReferenceCandidate.mySafeQualifier && methodReferenceCandidate.myConformsCodeStyle
? ProblemHighlightType.LIKE_UNUSED_SYMBOL
: ProblemHighlightType.INFORMATION;
ProblemDescriptorBase descriptor = new ProblemDescriptorBase(parent, parent,
"Anonymous #ref #loc can be replaced with method reference",
new LocalQuickFix[]{new ReplaceWithMethodRefFix()},
type, false, rangeInElement,
type != ProblemHighlightType.INFORMATION, true);
holder.registerProblem(descriptor);
holder.registerProblem(parent,
"Anonymous #ref #loc can be replaced with method reference",
type, rangeInElement, new ReplaceWithMethodRefFix());
}
}
}
@@ -47,12 +47,9 @@ public class OptionalIsPresentInspection extends AbstractBaseJavaLocalInspection
void registerProblem(ProblemsHolder holder, PsiExpression condition, OptionalIsPresentCase scenario) {
if(this != NONE) {
holder.registerProblem(holder.getManager().createProblemDescriptor(condition,
"Can be replaced with single expression in functional style",
this != INFO,
this == INFO ? ProblemHighlightType.INFORMATION : ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
true,
new OptionalIsPresentFix(scenario)));
holder.registerProblem(condition, "Can be replaced with single expression in functional style",
this == INFO ? ProblemHighlightType.INFORMATION : ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
new OptionalIsPresentFix(scenario));
}
}
}
@@ -100,8 +100,8 @@ public class Java8MapForEachInspection extends AbstractBaseJavaLocalInspectionTo
else {
range = new TextRange(0, firstChild.getTextLength());
}
holder.registerProblem(new ProblemDescriptorBase(firstChild, firstChild, InspectionsBundle.message("inspection.map.foreach.message"),
new LocalQuickFix[]{new ReplaceWithMapForEachFix()}, type, false, range, type != ProblemHighlightType.INFORMATION, holder.isOnTheFly()));
holder.registerProblem(loop.getFirstChild(), InspectionsBundle.message("inspection.map.foreach.message"),
type, range, new ReplaceWithMapForEachFix());
}
}
};
@@ -80,7 +80,7 @@ public abstract class InspectionManagerBase extends InspectionManager {
@NotNull ProblemHighlightType highlightType,
boolean onTheFly,
boolean isAfterEndOfLine) {
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, isAfterEndOfLine, null, true, onTheFly);
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, isAfterEndOfLine, null, highlightType != ProblemHighlightType.INFORMATION, onTheFly);
}
@Override
@@ -91,7 +91,7 @@ public abstract class InspectionManagerBase extends InspectionManager {
@NotNull ProblemHighlightType highlightType,
boolean onTheFly,
LocalQuickFix... fixes) {
return new ProblemDescriptorBase(startElement, endElement, descriptionTemplate, fixes, highlightType, false, null, true, onTheFly);
return new ProblemDescriptorBase(startElement, endElement, descriptionTemplate, fixes, highlightType, false, null, highlightType != ProblemHighlightType.INFORMATION, onTheFly);
}
@NotNull
@@ -102,7 +102,7 @@ public abstract class InspectionManagerBase extends InspectionManager {
@NotNull final ProblemHighlightType highlightType,
boolean onTheFly,
final LocalQuickFix... fixes) {
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, false, rangeInElement, true, onTheFly);
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, false, rangeInElement, highlightType != ProblemHighlightType.INFORMATION, onTheFly);
}
@NotNull