diff --git a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
index 6d347deff183..7b91af9b9daa 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightMethodUtil.java
@@ -1032,7 +1032,9 @@ public class HighlightMethodUtil {
PsiParameter parameter = i < parameters.length ? parameters[i] : null;
PsiExpression expression = i < expressions.length ? expressions[i] : null;
if (assignmentCompatible(i, parameters, expressions, substitutor)) continue;
- boolean showShortType = HighlightUtil.showShortType(parameter != null ? substitutor.substitute(parameter.getType()) : null,
+ boolean varargs = info != null && info.getApplicabilityLevel() == MethodCandidateInfo.ApplicabilityLevel.VARARGS;
+ PsiType parameterType = PsiTypesUtil.getParameterType(parameters, i, varargs);
+ boolean showShortType = HighlightUtil.showShortType(substitutor.substitute(parameterType),
expression != null ? expression.getType() : null);
s.append("
");
if (parameter != null) {
diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/TooltipShortTypeNames.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/TooltipShortTypeNames.java
new file mode 100644
index 000000000000..f39453b9b607
--- /dev/null
+++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/genericsHighlighting8/TooltipShortTypeNames.java
@@ -0,0 +1,6 @@
+class MyTest {
+
+ private void paramTypeMismatch() {
+ String.join(",", "start", 1, "end");
+ }
+}
\ No newline at end of file
diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GenericsHighlighting8Test.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
index 30179e46f314..cb12359381fc 100644
--- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
+++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/lambda/GenericsHighlighting8Test.java
@@ -21,6 +21,8 @@ import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection;
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
import com.intellij.codeInspection.unusedImport.UnusedImportInspection;
+import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
+import com.intellij.openapi.editor.colors.EditorColorsUtil;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
import com.intellij.openapi.ui.DialogWrapper;
@@ -1064,6 +1066,33 @@ public class GenericsHighlighting8Test extends LightDaemonAnalyzerTestCase {
.forEach(info -> Assert.assertEquals(expected, info.getToolTip()));
}
+ public void testTooltipShortTypeNames() {
+ 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 = "" +
+ "" +
+ " | " +
+ "Required type | " +
+ "Provided |
" +
+ "" +
+ " | " +
+ "CharSequence... | " +
+ "String |
" +
+ " | | int |
" +
+ " | | String |
" +
+ "
";
+
+ doHighlighting()
+ .stream()
+ .filter(info -> info.type == HighlightInfoType.ERROR)
+ .forEach(info -> Assert.assertEquals(expected, info.getToolTip()));
+ }
+
public void testBridgeMethodOverriding() { doTest(); }
public void testNestedWildcardsWithImplicitBounds() { doTest(); }
public void testCallOnRawWithExplicitTypeArguments() { doTest(); }