do not show tooltips for INFORMATION infos for some inspections

This commit is contained in:
Alexey Kudravtsev
2017-02-20 15:52:49 +03:00
parent 0b3a66fc4b
commit 18547af62e
6 changed files with 46 additions and 24 deletions
@@ -100,21 +100,34 @@ public class AnonymousCanBeLambdaInspection extends BaseJavaBatchLocalInspection
final PsiElement lBrace = aClass.getLBrace();
LOG.assertTrue(lBrace != null);
final TextRange rangeInElement = new TextRange(0, aClass.getStartOffsetInParent() + lBrace.getStartOffsetInParent());
ProblemHighlightType problemHighlightType = ProblemHighlightType.LIKE_UNUSED_SYMBOL;
ProblemHighlightType type = ProblemHighlightType.LIKE_UNUSED_SYMBOL;
if (isOnTheFly && !reportNotAnnotatedInterfaces) {
final PsiClass baseClass = aClass.getBaseClassType().resolve();
LOG.assertTrue(baseClass != null);
if (!AnnotationUtil.isAnnotated(baseClass, CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE, false, false)) {
problemHighlightType = ProblemHighlightType.INFORMATION;
type = ProblemHighlightType.INFORMATION;
}
}
holder.registerProblem(parent, "Anonymous #ref #loc can be replaced with lambda",
problemHighlightType, rangeInElement, new ReplaceWithLambdaFix());
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);
}
}
};
}
interface R { void run(); }
void f(R r) {
f(new R() {
@Override
public void run() {
System.out.println();
}
});
}
static boolean hasRuntimeAnnotations(PsiMethod method, @NotNull Set<String> runtimeAnnotationsToIgnore) {
PsiAnnotation[] annotations = method.getModifierList().getAnnotations();
for (PsiAnnotation annotation : annotations) {
@@ -75,10 +75,9 @@ public class SuperClassHasFrequentlyUsedInheritorsInspection extends BaseJavaBat
break;
}
}
return new ProblemDescriptor[]{manager
.createProblemDescriptor(aClass, getDisplayName(), false,
topInheritorsQuickFix.toArray(new LocalQuickFix[topInheritorsQuickFix.size()]),
ProblemHighlightType.INFORMATION)};
return new ProblemDescriptor[]{
manager.createProblemDescriptor(aClass, getDisplayName(), false, ProblemHighlightType.INFORMATION, false,
topInheritorsQuickFix.toArray(new LocalQuickFix[topInheritorsQuickFix.size()]))};
}
@Nullable