I don't know any test which would prove $g$ is a polynomial. I assume $u$ to be a holomorphic function, wrote the power series expansion, and separated out the $z$ term, and I am left with $\sum_{1}^{\infty}a_mz^m (\int_{0}^{2\pi} cos(m\theta)sin\theta d\theta + i\int_{0}^{2\pi} sin(\theta)^{m+1})$ where $m$ varies from 1 to $\infty$.
So my issue is , I don't see how this gives me a polynomial and even if it gives me a polynomial, this was under the assumtion that $u$ is holomorhphic. What about a general harmonic function?