If a function is analytic at every point on or between two different paths between the same points, then the integral will be the same for the two paths.
In order to have an integral "independent of the path"- that is, the same for every possible path between two points, then the function would have to be analytic at every point- "holomorphic".
You might remember from Calculus of two variable that [itex]\int f(x,y)dx+ g(x,y)dy[/itex] is "independent of the path" if and only if [itex]\partial f/\partial y= \partial g/\partial x[/itex]. Here, the integral would be [itex]\int (x^2+ y)dx+ xy dy[/itex]. [itex]\partial (x^2+ y)/\partial y= 1[/itex] but [itex]\partial xy/\partial x= y[/itex].