boolean (@Nullable PsiExpression lhs, @Nullable PsiExpression rhs) { if (lhs == null || rhs == null) { return false; } final PsiType lhsType = lhs.getType(); if (lhsType == null) { return false; } final PsiType rhsType = rhs.getType(); if (rhsType == null) { return false; } if (lhsType instanceof PsiPrimitiveType) { if (!lhsType.equals(rhsType)) { return false; } } else { if (!lhsType.isAssignableFrom(rhsType) || rhsType instanceof PsiPrimitiveType) { return false; } } return true; }