Why doesn't $f(z) = | z |^{2}$ contradict Morera's theorem? Consider the function $f(z) = | z|^{2}$. It is continuous on some open ball $D$ around the origin, but is only complex differentiable at the origin. Therefore it is not holomorphic on $D$. 
Further, $f(z)$ has no poles in $D$ so by the residue theorem the integral over any closed curve is $0$. 
Why then does this not contradict Morera's theorem, which states:
If $f$ is continuous on an open disc and the integral of $f$ over all closed curves in the open disc is zero then f is holomorphic. 
 A: The residue theorem you're trying to appeal to only applies if you already know that the function is complex differentiable (except for isolated singularities). This one definitely isn't.
A: Try to integrate over a half circle centered at the origin of radius $1$, namely go from $1$ to $-1$ in a straight line and then around a circle of radius $1$ from $-1$ back to $1$ . The straight segment will contribute to
$$
\int_{1}^{-1} z^2 dz = \left. \frac{z^3}3 \right|_{1}^{-1} = -\frac 23
$$
and the circle arc will contribute to 
$$
\int_{-1}^1 dz = \left. z \right|_{-1}^1 = 2. 
$$
The point of this example is that even without computing anything (the proof that I didn't compute and still had faith is that I got the computations wrong the first time... yet it was still the correct example!), is that $|z|^2$ is a function which behaves significantly differently along radial axes compared to along centered circle arcs, so I exploited this fact to find my example. Along a circle is not a problem for this function since it behaves like a constant on these (and constants are holomorphic, so...)
Hope that helps,
