ProblemPresentation (@NotNull CommonProblemDescriptor descriptor, @Nullable PsiElement element, @FlagConstant int flags) { NotNullLazyValue<@InspectionMessage String> descTemplate = NotNullLazyValue.volatileLazy( () -> StringUtil.notNullize(descriptor.getDescriptionTemplate())); NotNullLazyValue<@InspectionMessage String> tooltipTemplate = NotNullLazyValue.volatileLazy( () -> descriptor instanceof ProblemDescriptor ? StringUtil.notNullize(((ProblemDescriptor)descriptor).getTooltipTemplate()) : descTemplate.getValue() ); NotNullLazyValue<@InspectionMessage String> description = NotNullLazyValue.volatileLazy( () -> renderDescriptionMessage(descriptor, element, flags, descTemplate.getValue())); NotNullLazyValue<@NlsContexts.Tooltip String> tooltip = NotNullLazyValue.volatileLazy(() -> { String template = tooltipTemplate.getValue(); return template.equals(descTemplate.getValue()) ? description.getValue() : renderDescriptionMessage(descriptor, element, flags, template); }); return new ProblemPresentation() { @Override public @NotNull String getDescription() { return description.getValue(); } @Override public @NotNull String getTooltip() { return tooltip.getValue(); } }; }