From 7445e7fdc2ad98686d2753775a1abd8b668fdeaf Mon Sep 17 00:00:00 2001 From: anna Date: Thu, 31 Oct 2013 17:55:41 +0100 Subject: [PATCH] accept intersection types in javadoc --- .../codeInsight/javadoc/JavaDocInfoGenerator.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java index 0591b8f27d47..ea5a668221af 100644 --- a/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java +++ b/java/java-psi-impl/src/com/intellij/codeInsight/javadoc/JavaDocInfoGenerator.java @@ -1661,7 +1661,7 @@ public class JavaDocInfoGenerator { return length; } - if (type instanceof PsiDisjunctionType) { + if (type instanceof PsiDisjunctionType || type instanceof PsiIntersectionType) { if (!generateLink) { final String text = StringUtil.escapeXml(type.getCanonicalText()); buffer.append(text); @@ -1669,9 +1669,17 @@ public class JavaDocInfoGenerator { } else { int length = 0; - for (PsiType psiType : ((PsiDisjunctionType)type).getDisjunctions()) { + final String separator = type instanceof PsiDisjunctionType ? " | " : " & "; + final List componentTypes; + if (type instanceof PsiIntersectionType) { + componentTypes = Arrays.asList(((PsiIntersectionType)type).getConjuncts()); + } + else { + componentTypes = ((PsiDisjunctionType)type).getDisjunctions(); + } + for (PsiType psiType : componentTypes) { if (length > 0) { - buffer.append(" | "); + buffer.append(separator); length += 3; } length += generateType(buffer, psiType, context, generateLink);