mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
OptionalUtil#getMapTypeArgument: check nulls; remove 0-arg check
This commit is contained in:
@@ -141,11 +141,14 @@ public class OptionalUtil {
|
||||
@NotNull
|
||||
public static String getMapTypeArgument(PsiExpression expression, PsiType type) {
|
||||
if (!(type instanceof PsiClassType)) return "";
|
||||
if (((PsiClassType)type).getParameterCount() == 0) {
|
||||
PsiExpression copy =
|
||||
JavaPsiFacade.getElementFactory(expression.getProject()).createExpressionFromText(expression.getText(), expression);
|
||||
PsiType exprType = copy.getType();
|
||||
if (exprType != null && !LambdaUtil.notInferredType(exprType) && TypeConversionUtil.isAssignable(type, exprType)) return "";
|
||||
PsiExpression copy =
|
||||
JavaPsiFacade.getElementFactory(expression.getProject()).createExpressionFromText(expression.getText(), expression);
|
||||
PsiType exprType = copy.getType();
|
||||
if (exprType != null &&
|
||||
!exprType.equals(PsiType.NULL) &&
|
||||
!LambdaUtil.notInferredType(exprType) &&
|
||||
TypeConversionUtil.isAssignable(type, exprType)) {
|
||||
return "";
|
||||
}
|
||||
return "<" + type.getCanonicalText() + ">";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user