Quadratic and non-linear expressions cannot be mixed up!

Hi, I am setting up a non-linear objective which contains both quadratic and non-linear terms. However, I am getting the following error

Unexpected quadratic expression 378.5346047250809 e[1]² + 378.5346047250809 f[1]² + 378.5346047250809 e[2]² + 378.5346047250809 f[2]² - 757.0692094501618 e[1]*e[2] - 757.0692094501618 f[1]*f[2] in nonlinear expression. 
Quadratic expressions (e.g., created using @expression) and nonlinear expressions cannot be mixed.

Now, the thing is I am setting non-linear constraints as well which contains both quadratic and non-linear expressions using @NLconstraint macro but I am not getting the above mentioned error. For the objective function, I need the summation of non-linear expression, therefore, I set up a loop and store all non-linear expressions in an array, and then I am using the ‘sum’ function in order to get the final expression. However, when I give this final expression to @NLobjective macro, I am getting the above-mentioned error. Why is that? and what would be the possible solutions to overcome this error?

The code for objective function is as follows:

ploss = []
for i in 1:nLines
    rline = nw_lines[i].line_r
    gij_line = real(yij_line[i,1])
    bij_line = imag(yij_line[i,1])
    lcrnt    = (gij_line^2+bij_line^2)*((e[nw_lines[i].line_from]^2+f[nw_lines[i].line_from]^2)+(e[nw_lines[i].line_to]^2+f[nw_lines[i].line_to]^2)
                                    -2(e[nw_lines[i].line_from]*e[nw_lines[i].line_to]+f[nw_lines[i].line_from]*f[nw_lines[i].line_to]))
    push!(ploss,lcrnt)
end
loss_expr = sum(ploss[j] for j in 1:size(ploss,1))
@NLobjective(acopf,Min,loss_expr)

Use @objective instead of @NLobjective. @objective can be used with linear and quadratic terms.

But my objective also contains the product of two variables and I cannot set it using @objective macro. So, I have a combination of quadratic terms

e[i]^2+f[i]^2

and bilinear terms

e[i]*e[j]+f[i]f[j]

and I cannot set it using @objective macro.

Please try it; you can add bilinear terms with @objective.

Well, it worked. But honestly speaking, I was not expecting it.
I have a lot of constraints which are the mixture of quadratic and non-linear expressions and I have set them through @NLconstraint macro. I was expecting the same for the objective (containing both quad and NL expressions); however, it seems that I was wrong. Although I have also looked into non-linear modelling page of JuMP and still, I believe that I was setting the objective right way.
Anyway, thanks a lot, man!