mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
incompatibility types tooltip: show varargs parameter once (IDEA-226535)
GitOrigin-RevId: 489681a2196ba79d39964ca0f8c3e6a24b3cff80
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0c3405cf59
commit
41dd307bc0
+1
@@ -1043,6 +1043,7 @@ public class HighlightMethodUtil {
|
||||
PsiParameter parameter = null;
|
||||
if (i < parameters.length) {
|
||||
parameter = parameters[i];
|
||||
varargAdded = parameter.isVarArgs();
|
||||
}
|
||||
else if (!varargAdded) {
|
||||
parameter = parameters[parameters.length - 1];
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class MyTest {
|
||||
void processStrings(String s, String... list) {
|
||||
System.out.println(list);
|
||||
}
|
||||
|
||||
void test() {
|
||||
processStrings("", <error descr="'processStrings(java.lang.String, java.lang.String...)' in 'MyTest' cannot be applied to '(java.lang.String, int, int)'">1</error>, <error descr="'processStrings(java.lang.String, java.lang.String...)' in 'MyTest' cannot be applied to '(java.lang.String, int, int)'">1</error>);
|
||||
}
|
||||
}
|
||||
+23
@@ -1090,6 +1090,29 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
|
||||
.forEach(info -> Assert.assertEquals(expected, info.getToolTip()));
|
||||
}
|
||||
|
||||
public void testVarargsTooltip2() {
|
||||
doTest();
|
||||
String toolTipForeground = ColorUtil.toHtmlColor(UIUtil.getToolTipForeground());
|
||||
String greyed = ColorUtil.toHtmlColor(UIUtil.getContextHelpForeground());
|
||||
String red = ColorUtil.toHtmlColor(DialogWrapper.ERROR_FOREGROUND_COLOR);
|
||||
String paramBgColor = ColorUtil.toHtmlColor(EditorColorsUtil.getGlobalOrDefaultColorScheme()
|
||||
.getAttributes(DefaultLanguageHighlighterColors.INLINE_PARAMETER_HINT)
|
||||
.getBackgroundColor());
|
||||
String expected = "<html><body><table>" +
|
||||
"<tr><td/><td style='color: " + greyed + "; padding-left: 16px; padding-right: 24px;'>Required type</td>" +
|
||||
"<td style='color: " + greyed + "; padding-right: 28px;'>Provided</td></tr>" +
|
||||
"<tr><td><table><tr><td style='color: " + greyed + "; font-size:12pt; padding:1px 4px 1px 4px;background-color: " + paramBgColor + ";'>list:</td></tr></table></td>" +
|
||||
"<td style='padding-left: 16px; padding-right: 24px;'><font color='" + toolTipForeground + "'>String...</font></td>" +
|
||||
"<td style='padding-right: 28px;'><font color='" + red + "'>int</font></td></tr>" +
|
||||
"<tr><td/><td style='padding-left: 16px; padding-right: 24px;'/><td style='padding-right: 28px;'><font color='" + red + "'>int</font></td></tr>" +
|
||||
"</table></body></html>";
|
||||
|
||||
doHighlighting()
|
||||
.stream()
|
||||
.filter(info -> info.type == HighlightInfoType.ERROR)
|
||||
.forEach(info -> Assert.assertEquals(expected, info.getToolTip()));
|
||||
}
|
||||
|
||||
public void testTooltipShortTypeNames() {
|
||||
doTest();
|
||||
String toolTipForeground = ColorUtil.toHtmlColor(UIUtil.getToolTipForeground());
|
||||
|
||||
Reference in New Issue
Block a user