From eb32bc4e489b9f8953d5f89246b0c61d48e16cd1 Mon Sep 17 00:00:00 2001 From: Eugene Vigdorchik Date: Mon, 21 Mar 2005 22:15:03 +0300 Subject: [PATCH] IDEA-1031 --- openapi/src/com/intellij/psi/GenericsUtil.java | 4 +++- .../impl/source/tree/java/PsiConditionalExpressionImpl.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openapi/src/com/intellij/psi/GenericsUtil.java b/openapi/src/com/intellij/psi/GenericsUtil.java index 55be1abdc338..24b98cff1563 100644 --- a/openapi/src/com/intellij/psi/GenericsUtil.java +++ b/openapi/src/com/intellij/psi/GenericsUtil.java @@ -26,7 +26,9 @@ public class GenericsUtil { } public static PsiType getLeastUpperBound(PsiType type1, PsiType type2, PsiManager manager) { - if (type1 instanceof PsiPrimitiveType || type2 instanceof PsiPrimitiveType) return null; + if (TypeConversionUtil.isPrimitiveAndNotNull(type1) || TypeConversionUtil.isPrimitiveAndNotNull(type2)) return null; + if (TypeConversionUtil.isNullType(type1)) return type2; + if (TypeConversionUtil.isNullType(type2)) return type1; return getLeastUpperBound(type1, type2, new LinkedHashSet>(), manager); } diff --git a/source/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java b/source/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java index 8de71b3c59a4..778dec0c1cc9 100644 --- a/source/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java +++ b/source/com/intellij/psi/impl/source/tree/java/PsiConditionalExpressionImpl.java @@ -62,9 +62,9 @@ public class PsiConditionalExpressionImpl extends CompositePsiElement implements return null; } else { - if (type1 instanceof PsiPrimitiveType) type1 = ((PsiPrimitiveType)type1).getBoxedType(getManager(), getResolveScope()); + if (TypeConversionUtil.isPrimitiveAndNotNull(type1)) type1 = ((PsiPrimitiveType)type1).getBoxedType(getManager(), getResolveScope()); if (type1 == null) return null; - if (type2 instanceof PsiPrimitiveType) type2 = ((PsiPrimitiveType)type2).getBoxedType(getManager(), getResolveScope()); + if (TypeConversionUtil.isPrimitiveAndNotNull(type2)) type2 = ((PsiPrimitiveType)type2).getBoxedType(getManager(), getResolveScope()); if (type2 == null) return null; return GenericsUtil.getLeastUpperBound(type1, type2, getManager());