mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
java incompatible types tooltip: include capture in short presentation (IDEA-230232)
GitOrigin-RevId: 22cc104f18f62e0b55738c5c8a72fcb4b8fe828c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2d86d02e1a
commit
dd40888635
@@ -2898,7 +2898,7 @@ public class HighlightUtil extends HighlightUtilBase {
|
||||
static String redIfNotMatch(@Nullable PsiType type, boolean matches, boolean shortType) {
|
||||
if (type == null) return "";
|
||||
String color = ColorUtil.toHtmlColor(matches ? UIUtil.getToolTipForeground() : DialogWrapper.ERROR_FOREGROUND_COLOR);
|
||||
return "<font color='" + color + "'>" + XmlStringUtil.escapeString(shortType ? type.getPresentableText() : type.getCanonicalText()) + "</font>";
|
||||
return "<font color='" + color + "'>" + XmlStringUtil.escapeString(shortType || type instanceof PsiCapturedWildcardType ? type.getPresentableText() : type.getCanonicalText()) + "</font>";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class A<T>{
|
||||
|
||||
public void setClazz(Class<T> clazz) {
|
||||
}
|
||||
|
||||
public void m(final A<?> a, Class<?> clazz) {
|
||||
a.setClazz<error descr="'setClazz(java.lang.Class<capture<?>>)' in 'A' cannot be applied to '(java.lang.Class<capture<?>>)'">(clazz)</error>;
|
||||
}
|
||||
}
|
||||
@@ -1137,6 +1137,29 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
.forEach(info -> Assert.assertEquals(expected, info.getToolTip()));
|
||||
}
|
||||
|
||||
public void testTooltipWithCapture() {
|
||||
doTest();
|
||||
String toolTipForeground = ColorUtil.toHtmlColor(UIUtil.getToolTipForeground());
|
||||
String greyed = ColorUtil.toHtmlColor(UIUtil.getContextHelpForeground());
|
||||
String red = ColorUtil.toHtmlColor(DialogWrapper.ERROR_FOREGROUND_COLOR);
|
||||
String expected = "<html><body><table>" +
|
||||
"<tr>" +
|
||||
"<td style='padding: 0px 16px 8px 4px;color: " + greyed + "'>Required type:</td>" +
|
||||
"<td style='padding: 0px 4px 8px 0px;'><font color='" + toolTipForeground + "'>Class</font></td>" +
|
||||
"<td style='padding: 0px 0px 8px 0px;'><<font color='" + toolTipForeground + "'>capture of ?</font>></td>" +
|
||||
"</tr>" +
|
||||
"<tr>" +
|
||||
"<td style='padding: 0px 16px 0px 4px;color: " + greyed + "'>Provided:</td>" +
|
||||
"<td style='padding: 0px 4px 0px 0px;'><font color='" + toolTipForeground + "'>Class</font></td>" +
|
||||
"<td style='padding: 0px 0px 0px 0px;'><<font color='" + red + "'>capture of ?</font>></td></tr>" +
|
||||
"</table></body></html>";
|
||||
|
||||
doHighlighting()
|
||||
.stream()
|
||||
.filter(info -> info.type == HighlightInfoType.ERROR)
|
||||
.forEach(info -> Assert.assertEquals(expected, info.getToolTip()));
|
||||
}
|
||||
|
||||
public void testTooltipComponents() {
|
||||
doTest();
|
||||
String toolTipForeground = ColorUtil.toHtmlColor(UIUtil.getToolTipForeground());
|
||||
|
||||
Reference in New Issue
Block a user